Files
mesh-controller/internal/lint/removed_test.go
T

44 lines
1.4 KiB
Go

package lint
import (
"os"
"path/filepath"
"testing"
)
// What this repository no longer holds (R4g, design 47 acceptance test 24): the checker runs the build module's own steps
// and the repository's tests, so no script of the repository stands in for them. A file named here came back.
// root is this repository's root, from the package's directory.
const root = "../.."
func TestTheRepositoryHoldsNoMergeCheckScript(t *testing.T) {
for _, name := range []string{"merge-check.sh", "check-nested-modules.sh", "RELEASE-57.md", "testdata/store-tests"} {
if _, err := os.Stat(filepath.Join(root, name)); err == nil {
t.Errorf("%s is in the repository: the checker (ADR 0501 §5) runs its steps, and no script of the repository "+
"stands in for it", name)
}
}
}
// No module of this repository keeps a copy of its dependencies (issue 1305): the build module fetches them, and
// `go build ./...` with GOFLAGS=-mod=mod is how every build reads them.
func TestTheRepositoryHoldsNoVendorDirectory(t *testing.T) {
err := filepath.WalkDir(root, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() && d.Name() == ".git" {
return filepath.SkipDir
}
if d.IsDir() && d.Name() == "vendor" {
t.Errorf("%s is a vendor directory: dependencies are fetched, never kept (issue 1305)", path)
return filepath.SkipDir
}
return nil
})
if err != nil {
t.Fatal(err)
}
}