MCPcopy Create free account
hub / github.com/bufbuild/buf / TestWorkspaceWithInvalidArchiveAbsolutePathFail

Function TestWorkspaceWithInvalidArchiveAbsolutePathFail

cmd/buf/workspace_test.go:1613–1659  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1611}
1612
1613func TestWorkspaceWithInvalidArchiveAbsolutePathFail(t *testing.T) {
1614 if runtime.GOOS == "windows" {
1615 // TODO FUTURE: failing test, fix on windows, there is temp dir clean-up fail, a reference to archive.zip not closed
1616 t.Skip()
1617 }
1618 // The --path flag did not reference an absolute file patfound in the archive.
1619 zipDir := createZipFromDir(
1620 t,
1621 filepath.Join("testdata", "workspace", "success", "dir"),
1622 "archive.zip",
1623 )
1624 wd, err := osext.Getwd()
1625 require.NoError(t, err)
1626 testRunStdoutStderrNoWarn(
1627 t,
1628 nil,
1629 1,
1630 ``,
1631 filepath.FromSlash(fmt.Sprintf(
1632 `Failure: %s/proto/rpc.proto: expected to be relative`,
1633 wd,
1634 )),
1635 "lint",
1636 filepath.Join(zipDir, "archive.zip#subdir=proto"),
1637 "--path",
1638 filepath.Join(wd, "proto", "rpc.proto"),
1639 )
1640 zipDir = createZipFromDir(
1641 t,
1642 filepath.Join("testdata", "workspace", "success", "v2", "dir"),
1643 "archive.zip",
1644 )
1645 testRunStdoutStderrNoWarn(
1646 t,
1647 nil,
1648 1,
1649 ``,
1650 filepath.FromSlash(fmt.Sprintf(
1651 `Failure: %s/proto/rpc.proto: expected to be relative`,
1652 wd,
1653 )),
1654 "lint",
1655 filepath.Join(zipDir, "archive.zip#subdir=proto"),
1656 "--path",
1657 filepath.Join(wd, "proto", "rpc.proto"),
1658 )
1659}
1660
1661func TestWorkspaceWithTargetingModuleCommonParentDir(t *testing.T) {
1662 workspaceDir := filepath.Join("testdata", "workspace", "success", "shared_parent_dir")

Callers

nothing calls this directly

Calls 3

GetwdFunction · 0.92
createZipFromDirFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…