package main import ( "os" "path/filepath" "strings" "testing" ) // 1305/AC1: the tree holds no vendor directory (root and modules/route-proxy), .gitignore names vendor/, and the root // Dockerfile builds with -mod=mod. func TestTheTreeCommitsNoDependencies(t *testing.T) { root := filepath.Join("..", "..") for _, d := range []string{"vendor", filepath.Join("modules", "route-proxy", "vendor")} { if _, err := os.Stat(filepath.Join(root, d)); err == nil { t.Errorf("%s is committed", d) } } ignore, err := os.ReadFile(filepath.Join(root, ".gitignore")) if err != nil || !strings.Contains(string(ignore), "\nvendor/\n") { t.Errorf(".gitignore does not name vendor/: %v", err) } docker, err := os.ReadFile(filepath.Join(root, "Dockerfile")) if err != nil || strings.Contains(string(docker), "-mod=vendor") || !strings.Contains(string(docker), "-mod=mod") { t.Errorf("the Dockerfile does not build with -mod=mod: %v", err) } }