demo protections e2e: warm the module cache before offline builds
TestDemoProtectionsSourceToLimitAndTakedown built its fixture with GOPROXY=off and passed only when demo_e2e_test had already warmed the runner's module cache, so main CI went red at 7d0f26c on a cold worker. It now downloads the locked closure first, as demoE2EBuilds does. Squashed from demo-protections-warm-cache into main.
1 file changed,
+27
−0
internal/console/demo_protections_e2e_test.go+27 −0
CI passed — run details
diff --git a/internal/console/demo_protections_e2e_test.go b/internal/console/demo_protections_e2e_test.go| index 595750de8..f62340195 100644 |
| --- a/internal/console/demo_protections_e2e_test.go |
| +++ b/internal/console/demo_protections_e2e_test.go |
| @@ -39,11 +39,38 @@ func demoProtectionWait(t *testing.T, what string, f func() bool) { |
| } |
| } |
| +// demoProtectionWarmCache downloads the locked demo closure through the |
| +// public proxy and sumdb, as demoE2EBuilds does (R23b), so the offline |
| +// builds below never depend on another test having warmed this runner's |
| +// module cache first. |
| +func demoProtectionWarmCache(t *testing.T, dir string) { |
| + t.Helper() |
| + lock, err := demobuild.DefaultLock() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, m := range lock.Modules { |
| + cmd := exec.CommandContext(t.Context(), "go", "mod", "download", "-json", m.Path+"@"+m.Version) |
| + cmd.Dir = dir |
| + cmd.Env = append(os.Environ(), "GOPROXY=https://proxy.golang.org,direct", "GOSUMDB=sum.golang.org", "GOPRIVATE=", "GONOPROXY=none", "GONOSUMDB=none", "GOENV=off", "GOTOOLCHAIN=local", "GOWORK=off", "GOFLAGS=") |
| + var stderr bytes.Buffer |
| + cmd.Stderr = &stderr |
| + out, err := cmd.Output() |
| + if err != nil { |
| + t.Fatalf("download locked demo closure %s@%s before offline build: %v\n%s\n%s", m.Path, m.Version, err, out, stderr.String()) |
| + } |
| + if err := demoE2EVerifyDownload(out, m); err != nil { |
| + t.Fatalf("verify locked demo closure %s@%s before offline build: %v", m.Path, m.Version, err) |
| + } |
| + } |
| +} |
| + |
| // All compiler invocations happen here on the development machine, offline. |
| // The worker substitutes prebuilt arm64 output for root's isolated compiler; |
| // the matching native binary runs with the real --socket/--db contract. |
| func demoProtectionBuilds(t *testing.T, dir string) ([][]byte, []string, []string, string) { |
| t.Helper() |
| + demoProtectionWarmCache(t, dir) |
| var archives [][]byte |
| var arm, native []string |
| for _, rev := range []string{"one", "two"} { |