activator: only waits that read a file need its content; touched markers exist
39973798 made waitForFile wait for content, which broke
TestChildProcStopKeepsTheControlSocketUpUntilTheChildExits on this
branch's CI: its ready and termed markers are touched, so they stay
empty ("ready never appeared within 10s").
waitForFile is existence again. waitForFileContent waits for content and
is used at the 41 sites that read what they waited for (printf and env
recorders, none touched). The whole package passes here (TMPDIR under
/tmp; the two TestOverLongFlatHost tests need a short TMPDIR and fail the
same way before this branch when it is long).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+61
−48
internal/activator/activator_test.go+33 −20internal/activator/backend_exec_test.go+2 −2internal/activator/binary_golden_test.go+1 −1internal/activator/exec_gate_test.go+5 −5internal/activator/genbackend_test.go+2 −2internal/activator/generations_backend_test.go+2 −2internal/activator/gensocket_rev19_test.go+2 −2internal/activator/identity_test.go+6 −6internal/activator/instancekey_test.go+1 −1internal/activator/swap_sidecar_test.go+2 −2internal/activator/worker_generations_test.go+3 −3internal/activator/worker_staged_test.go+2 −2
CI passed — run details
Intent
diff --git a/internal/activator/activator_test.go b/internal/activator/activator_test.go| index 0571d8619..32c0e5d65 100644 |
| --- a/internal/activator/activator_test.go |
| +++ b/internal/activator/activator_test.go |
| @@ -5011,7 +5011,7 @@ func TestExecBackendStartWorkerEnvWinsOverTenantFile(t *testing.T) { |
| defer p.Stop(context.Background()) |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5121,17 +5121,30 @@ func stageRecordingLiveFullEnv(t *testing.T, b *ExecBackend, host, ver string) ( |
| return argvPath, envPath |
| } |
| -// waitForFile polls until path exists and has something in it (the child |
| -// writes it concurrently with Start's health wait) and returns its |
| -// contents. Existing is not enough: the child's shell creates the file for |
| -// its redirect before printf writes to it, and a read in between saw "" |
| -// (CI-load repro, TestExecBackendStartStagedRunsAForeignRowOnItsCanonicalSocket). |
| -// Every recorder writes at least a newline or a path, in one write. |
| +// waitForFile polls until path exists (the child writes it concurrently with |
| +// Start's health wait) and returns its contents. |
| func waitForFile(t *testing.T, path string, within time.Duration) string { |
| + t.Helper() |
| + return waitForFileWhere(t, path, within, func([]byte) bool { return true }) |
| +} |
| + |
| +// waitForFileContent is waitForFile for a file whose contents the test |
| +// reads: it waits until the file has something in it. Existing is not |
| +// enough there: the child's shell creates the file for its redirect before |
| +// printf writes to it, and a read in between saw "" (a CI-load repro, |
| +// TestExecBackendStartStagedRunsAForeignRowOnItsCanonicalSocket). Every |
| +// recorder whose contents are read writes at least a newline or a path, in |
| +// one write. A marker that is only touched is waited for with waitForFile. |
| +func waitForFileContent(t *testing.T, path string, within time.Duration) string { |
| + t.Helper() |
| + return waitForFileWhere(t, path, within, func(b []byte) bool { return len(b) > 0 }) |
| +} |
| + |
| +func waitForFileWhere(t *testing.T, path string, within time.Duration, ok func([]byte) bool) string { |
| t.Helper() |
| deadline := time.Now().Add(within) |
| for time.Now().Before(deadline) { |
| - if b, err := os.ReadFile(path); err == nil && len(b) > 0 { |
| + if b, err := os.ReadFile(path); err == nil && ok(b) { |
| return string(b) |
| } |
| time.Sleep(10 * time.Millisecond) |
| @@ -5196,8 +5209,8 @@ func TestExecBackendStartPassesControlSocketInEnvAndStartsPurgeListener(t *testi |
| time.Sleep(10 * time.Millisecond) |
| } |
| - gotArgv := strings.Fields(waitForFile(t, argvPath, time.Second)) |
| - gotEnv := strings.TrimSpace(waitForFile(t, envPath, time.Second)) |
| + gotArgv := strings.Fields(waitForFileContent(t, argvPath, time.Second)) |
| + gotEnv := strings.TrimSpace(waitForFileContent(t, envPath, time.Second)) |
| // Everything above was seen while the health wait ran; the fake never |
| // binds, so end the wait rather than sit out its timeout. |
| @@ -5269,7 +5282,7 @@ func TestExecBackendStartWithNilCacheStillBindsControlSocket(t *testing.T) { |
| time.Sleep(10 * time.Millisecond) |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5473,7 +5486,7 @@ func TestExecBackendStartMergesConfigEnvUnderOwnEnv(t *testing.T) { |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5520,7 +5533,7 @@ func TestExecBackendStartAdvertisesHeaderPurgeChannel(t *testing.T) { |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5531,7 +5544,7 @@ func TestExecBackendStartAdvertisesHeaderPurgeChannel(t *testing.T) { |
| if got := child["CARLOS_CONTROL_SOCKET"]; got != rt.Socket+".control" { |
| t.Fatalf("child CARLOS_CONTROL_SOCKET = %q, want %q — the header channel is ADDITIONAL, it does not replace the socket", got, rt.Socket+".control") |
| } |
| - gotArgv := strings.Fields(waitForFile(t, argvPath, time.Second)) |
| + gotArgv := strings.Fields(waitForFileContent(t, argvPath, time.Second)) |
| wantArgv := []string{"--socket", rt.Socket, "--db", filepath.Join(b.DataDir, rt.Host+".db")} |
| if !slices.Equal(gotArgv, wantArgv) { |
| t.Fatalf("child argv = %v, want %v — a flag the app binary doesn't parse makes it exit 2 at startup", gotArgv, wantArgv) |
| @@ -5558,7 +5571,7 @@ func TestExecBackendStartWithNilCacheSetsNoPurgeVar(t *testing.T) { |
| defer proc.Stop(context.Background()) |
| } |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, _, ok := strings.Cut(line, "="); ok && k == "CARLOS_PURGE" { |
| t.Fatalf("child saw %q with no cache configured", line) |
| } |
| @@ -5604,7 +5617,7 @@ func TestExecBackendStartTenantCannotClaimAbsentPurgeChannel(t *testing.T) { |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5652,7 +5665,7 @@ func TestExecBackendStartOverridesTenantSuppliedPurgeVars(t *testing.T) { |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5918,14 +5931,14 @@ func TestExecBackendSeedRunsDeclaredArgvWithDBPath(t *testing.T) { |
| t.Fatalf("Seed: %v", err) |
| } |
| - gotArgv := strings.Fields(waitForFile(t, argvPath, time.Second)) |
| + gotArgv := strings.Fields(waitForFileContent(t, argvPath, time.Second)) |
| wantArgv := []string{"seed", "--fixtures", "--db", filepath.Join(b.DataDir, host+".db")} |
| if !slices.Equal(gotArgv, wantArgv) { |
| t.Fatalf("seed argv = %v, want %v", gotArgv, wantArgv) |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -5964,7 +5977,7 @@ func TestExecBackendSeedHonoursRouteDBPath(t *testing.T) { |
| if err := b.Seed(context.Background(), registry.Route{Host: host, Kind: "instance", DBPath: dbPath, Seed: `["seed"]`}); err != nil { |
| t.Fatalf("Seed: %v", err) |
| } |
| - gotArgv := strings.Fields(waitForFile(t, argvPath, time.Second)) |
| + gotArgv := strings.Fields(waitForFileContent(t, argvPath, time.Second)) |
| wantArgv := []string{"seed", "--db", dbPath} |
| if !slices.Equal(gotArgv, wantArgv) { |
| t.Fatalf("seed argv = %v, want %v", gotArgv, wantArgv) |
diff --git a/internal/activator/backend_exec_test.go b/internal/activator/backend_exec_test.go| index 23a334b10..908535fc4 100644 |
| --- a/internal/activator/backend_exec_test.go |
| +++ b/internal/activator/backend_exec_test.go |
| @@ -222,7 +222,7 @@ func TestExecBackendStartChildRegion(t *testing.T) { |
| defer proc.Stop(context.Background()) |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
| @@ -254,7 +254,7 @@ func TestExecBackendStartChildHandsTheHost(t *testing.T) { |
| defer proc.Stop(context.Background()) |
| } |
| child := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| child[k] = v |
| } |
diff --git a/internal/activator/binary_golden_test.go b/internal/activator/binary_golden_test.go| index cc7aeb82b..4a6166133 100644 |
| --- a/internal/activator/binary_golden_test.go |
| +++ b/internal/activator/binary_golden_test.go |
| @@ -234,7 +234,7 @@ func TestBinaryStartStagedGolden(t *testing.T) { |
| t.Fatalf("StartStaged: %v", err) |
| } |
| defer proc.Stop(context.Background()) //nolint:errcheck |
| - argv := waitForFile(t, marker, 2*time.Second) |
| + argv := waitForFileContent(t, marker, 2*time.Second) |
| roots := map[string]string{b.OptDir: "$OPT", b.DataDir: "$DATA", b.RunDirOverride: "$RUN"} |
| raw, err := json.MarshalIndent(g, "", " ") |
| if err != nil { |
diff --git a/internal/activator/exec_gate_test.go b/internal/activator/exec_gate_test.go| index 30a5f99ee..4499ede11 100644 |
| --- a/internal/activator/exec_gate_test.go |
| +++ b/internal/activator/exec_gate_test.go |
| @@ -701,7 +701,7 @@ func TestALiveExecGateGatesTheFlatLiveLinkSpawn(t *testing.T) { |
| t.Fatalf("spawn = %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out, 5*time.Second)); got != v1 { |
| + if got := strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)); got != v1 { |
| t.Fatalf("$0 = %q, want the staged v1 the gate was asked about (%s)", got, v1) |
| } |
| if ver != "v1" || !slices.Equal(g.builds(), []string{"v1"}) { |
| @@ -738,7 +738,7 @@ func TestALiveExecGateGatesTheFlatLiveLinkSpawn(t *testing.T) { |
| t.Fatalf("spawn = %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out, 5*time.Second)); got != b.liveLink(rt.Host) || ver != "v1" { |
| + if got := strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)); got != b.liveLink(rt.Host) || ver != "v1" { |
| t.Fatalf("$0 = %q, version %q; want today's exec of %s, v1", got, ver, b.liveLink(rt.Host)) |
| } |
| }) |
| @@ -803,7 +803,7 @@ func TestALiveExecGateGatesAWorkerSpawnFromTheLiveLink(t *testing.T) { |
| t.Fatalf("recycle onto the captured v1 = %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if id != onto || strings.TrimSpace(waitForFile(t, out, 5*time.Second)) != v1 { |
| + if id != onto || strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)) != v1 { |
| t.Fatalf("recycled %+v, want the captured v1", id) |
| } |
| if !slices.Equal(g.builds(), []string{"v2"}) { |
| @@ -956,7 +956,7 @@ func TestALiveExecGateGatesTheLegacySidecarStart(t *testing.T) { |
| t.Fatalf("StartSidecar = %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out, 5*time.Second)); got != v1 { |
| + if got := strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)); got != v1 { |
| t.Fatalf("sidecar $0 = %q, want the staged v1 the gate was asked about (%s)", got, v1) |
| } |
| if !slices.Equal(g.builds(), []string{"v1"}) { |
| @@ -988,7 +988,7 @@ func TestALiveExecGateGatesTheLegacySidecarStart(t *testing.T) { |
| t.Fatalf("StartSidecar = %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out, 5*time.Second)); got != b.liveLink(rt.Host) { |
| + if got := strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)); got != b.liveLink(rt.Host) { |
| t.Fatalf("sidecar $0 = %q, want today's exec of %s", got, b.liveLink(rt.Host)) |
| } |
| }) |
diff --git a/internal/activator/genbackend_test.go b/internal/activator/genbackend_test.go| index 26583dc94..ade597785 100644 |
| --- a/internal/activator/genbackend_test.go |
| +++ b/internal/activator/genbackend_test.go |
| @@ -123,7 +123,7 @@ func TestExecBackendStartStagedExecsTheStagedPath(t *testing.T) { |
| t.Fatalf("StartStaged: %v", err) |
| } |
| defer proc.Stop(context.Background()) //nolint:errcheck |
| - if got := waitForFile(t, marker, 2*time.Second); got != v2 { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != v2 { |
| t.Fatalf("the generation execd %q, want the staged %q", got, v2) |
| } |
| } |
| @@ -203,7 +203,7 @@ func TestExecBackendStartStagedRunsAForeignRowOnItsCanonicalSocket(t *testing.T) |
| if g.Socket != rt.Socket || g.Control != rt.Socket+".control" { |
| t.Fatalf("foreign generation sockets %q %q, want the canonical %q", g.Socket, g.Control, rt.Socket) |
| } |
| - if got := waitForFile(t, marker, 2*time.Second); got != v2 { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != v2 { |
| t.Fatalf("the generation execd %q, want the staged %q", got, v2) |
| } |
| } |
diff --git a/internal/activator/generations_backend_test.go b/internal/activator/generations_backend_test.go| index d8c57d8ff..34740c044 100644 |
| --- a/internal/activator/generations_backend_test.go |
| +++ b/internal/activator/generations_backend_test.go |
| @@ -64,8 +64,8 @@ func TestStartGenWithGenerationsOffIsStart(t *testing.T) { |
| proc, _, _ = b.StartGen(ctx, rt, 5, false) // the recorder never binds; a health error is expected |
| close(done) |
| }() |
| - gotArgv := strings.Fields(waitForFile(t, argvPath, time.Second)) |
| - gotEnv := strings.TrimSpace(waitForFile(t, envPath, time.Second)) |
| + gotArgv := strings.Fields(waitForFileContent(t, argvPath, time.Second)) |
| + gotEnv := strings.TrimSpace(waitForFileContent(t, envPath, time.Second)) |
| cancel() // recorded: end the health wait the recorder never answers |
| <-done |
| if proc != nil { |
diff --git a/internal/activator/gensocket_rev19_test.go b/internal/activator/gensocket_rev19_test.go| index 42a64b2c1..f4fa1ced7 100644 |
| --- a/internal/activator/gensocket_rev19_test.go |
| +++ b/internal/activator/gensocket_rev19_test.go |
| @@ -116,8 +116,8 @@ func TestFlatGenerationLaunchMatchesTheFlagOffLaunch(t *testing.T) { |
| proc, g, _ = b.StartGen(ctx, rt, n, perGen) // the recorder never binds; a health error is expected |
| close(done) |
| }() |
| - argv := strings.Split(strings.TrimSpace(waitForFile(t, argvPath, 3*time.Second)), "\n") |
| - env := envMap(t, strings.Split(strings.TrimSpace(waitForFile(t, envPath, 3*time.Second)), "\n")) |
| + argv := strings.Split(strings.TrimSpace(waitForFileContent(t, argvPath, 3*time.Second)), "\n") |
| + env := envMap(t, strings.Split(strings.TrimSpace(waitForFileContent(t, envPath, 3*time.Second)), "\n")) |
| cancel() // recorded: end the health wait the recorder never answers |
| <-done |
| if proc != nil { |
diff --git a/internal/activator/identity_test.go b/internal/activator/identity_test.go| index 90f02dc7c..b24b305ea 100644 |
| --- a/internal/activator/identity_test.go |
| +++ b/internal/activator/identity_test.go |
| @@ -152,7 +152,7 @@ func TestStartGenExeFlatExecsTheRecordedFile(t *testing.T) { |
| t.Fatalf("StartGenExe: %v", err) |
| } |
| defer proc.Stop(context.Background()) //nolint:errcheck |
| - if got := waitForFile(t, marker, 2*time.Second); got != a { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != a { |
| t.Fatalf("execd %q, want the recorded %q", got, a) |
| } |
| // No TierOf here, so the build's tier is GenTier's fallback, the default. |
| @@ -208,7 +208,7 @@ func TestStartGenExeFlatPerGenBindsTheGenerationSocket(t *testing.T) { |
| if g.Socket != own || g.Control != own+".control" || !isSocket(own) { |
| t.Fatalf("handle = %+v, want generation 9's bound socket %s", g, own) |
| } |
| - if got := waitForFile(t, marker, 2*time.Second); got != a { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != a { |
| t.Fatalf("execd %q, want the recorded %q", got, a) |
| } |
| if _, err := os.Lstat(rt.Socket); !os.IsNotExist(err) { |
| @@ -243,7 +243,7 @@ func TestStartGenExeForeignRunsOnTheCanonicalSocket(t *testing.T) { |
| if g.Socket != rt.Socket || g.Build != "vA" { |
| t.Fatalf("handle = %+v, want vA on the canonical %s", g, rt.Socket) |
| } |
| - if got := waitForFile(t, marker, 2*time.Second); got != a { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != a { |
| t.Fatalf("execd %q, want the recorded %q", got, a) |
| } |
| } |
| @@ -265,7 +265,7 @@ func TestSeedExeFlatRunsTheRecordedFile(t *testing.T) { |
| if err := b.SeedExe(context.Background(), rt, id); err != nil { |
| t.Fatalf("SeedExe: %v", err) |
| } |
| - if got := waitForFile(t, marker, time.Second); got != a { |
| + if got := waitForFileContent(t, marker, time.Second); got != a { |
| t.Fatalf("seeded with %q, want the recorded %q", got, a) |
| } |
| @@ -282,7 +282,7 @@ func TestSeedExeFlatRunsTheRecordedFile(t *testing.T) { |
| if err := b.Seed(context.Background(), rt); err != nil { |
| t.Fatalf("Seed: %v", err) |
| } |
| - if got := waitForFile(t, marker, time.Second); got != b.liveLink(host) { |
| + if got := waitForFileContent(t, marker, time.Second); got != b.liveLink(host) { |
| t.Fatalf("Seed ran %q, want the live link (today's, which resolves to %s)", got, bPath) |
| } |
| } |
| @@ -610,7 +610,7 @@ func TestADeclinedFlatSeedRunsThePinnedFile(t *testing.T) { |
| if err := b.Seed(context.Background(), rt); err != nil { |
| t.Fatalf("Seed: %v", err) |
| } |
| - if got := waitForFile(t, marker, time.Second); got != v1 { |
| + if got := waitForFileContent(t, marker, time.Second); got != v1 { |
| t.Fatalf("seeded with %q, want the pinned %q", got, v1) |
| } |
| if got := g.builds(); !slices.Equal(got, []string{"v1"}) { |
diff --git a/internal/activator/instancekey_test.go b/internal/activator/instancekey_test.go| index 7c9301a64..3f9d64f0e 100644 |
| --- a/internal/activator/instancekey_test.go |
| +++ b/internal/activator/instancekey_test.go |
| @@ -809,7 +809,7 @@ func TestExecBackendSeedMintsTheKeyForAFreshFlatInstance(t *testing.T) { |
| t.Fatalf("Seed: %v", err) |
| } |
| seed := map[string]string{} |
| - for _, line := range strings.Split(waitForFile(t, envPath, time.Second), "\n") { |
| + for _, line := range strings.Split(waitForFileContent(t, envPath, time.Second), "\n") { |
| if k, v, ok := strings.Cut(line, "="); ok { |
| seed[k] = v |
| } |
diff --git a/internal/activator/swap_sidecar_test.go b/internal/activator/swap_sidecar_test.go| index 8da368f19..75ff3cdca 100644 |
| --- a/internal/activator/swap_sidecar_test.go |
| +++ b/internal/activator/swap_sidecar_test.go |
| @@ -651,7 +651,7 @@ func TestExecBackendStartSidecarGen(t *testing.T) { |
| t.Fatal(err) |
| } |
| defer p.Stop(context.Background()) //nolint:errcheck |
| - if got := waitForFile(t, marker, 2*time.Second); got != v2 { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != v2 { |
| t.Fatalf("the sidecar execd %q, want the generation's %q", got, v2) |
| } |
| }) |
| @@ -669,7 +669,7 @@ func TestExecBackendStartSidecarGen(t *testing.T) { |
| t.Fatal(err) |
| } |
| defer p.Stop(context.Background()) //nolint:errcheck |
| - if got := waitForFile(t, marker, 2*time.Second); got != v2 { |
| + if got := waitForFileContent(t, marker, 2*time.Second); got != v2 { |
| t.Fatalf("the sidecar execd %q, want the generation's %q", got, v2) |
| } |
| }) |
diff --git a/internal/activator/worker_generations_test.go b/internal/activator/worker_generations_test.go| index 22659f7e2..16b641228 100644 |
| --- a/internal/activator/worker_generations_test.go |
| +++ b/internal/activator/worker_generations_test.go |
| @@ -229,7 +229,7 @@ func TestWorkerCapturedBuildSurvivesARestageOfItsReusedName(t *testing.T) { |
| } |
| // The child's own startup write, waited out so it cannot land after the |
| // removal below and pass for the recycle's. |
| - if got := strings.TrimSpace(waitForFile(t, argv0, 5*time.Second)); got != stagedA { |
| + if got := strings.TrimSpace(waitForFileContent(t, argv0, 5*time.Second)); got != stagedA { |
| t.Fatalf("the wake exec'd %q; want A's staged path %s", got, stagedA) |
| } |
| captured := a.entryServing(host) |
| @@ -297,7 +297,7 @@ func TestWorkerCapturedBuildSurvivesARestageOfItsReusedName(t *testing.T) { |
| t.Fatalf("crash the worker: %v", err) |
| } |
| a.sweepOnce() |
| - if got := strings.TrimSpace(waitForFile(t, argv0, 5*time.Second)); got != stagedA { |
| + if got := strings.TrimSpace(waitForFileContent(t, argv0, 5*time.Second)); got != stagedA { |
| t.Fatalf("the recycle exec'd %q; want A's staged path %s", got, stagedA) |
| } |
| waitFor(t, "the recycle to land", func() bool { |
| @@ -472,7 +472,7 @@ func TestWorkerFromAChainedLinkIsPublishedByPath(t *testing.T) { |
| if err := a.WakeWorker(rt); err != nil { |
| t.Fatalf("WakeWorker: %v", err) |
| } |
| - if got := strings.TrimSpace(waitForFile(t, argv0, 5*time.Second)); got != staged { |
| + if got := strings.TrimSpace(waitForFileContent(t, argv0, 5*time.Second)); got != staged { |
| t.Fatalf("the wake exec'd %q; want %s", got, staged) |
| } |
| if id := a.entryServing(host); id.Version != "" || id.StagedPath != staged { |
diff --git a/internal/activator/worker_staged_test.go b/internal/activator/worker_staged_test.go| index b20dfe35d..03dd9b36b 100644 |
| --- a/internal/activator/worker_staged_test.go |
| +++ b/internal/activator/worker_staged_test.go |
| @@ -130,7 +130,7 @@ func TestExecBackendWorkerExecsTheStagedPathItResolved(t *testing.T) { |
| t.Fatalf("StartWorkerStaged: %v", err) |
| } |
| defer p.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out, 5*time.Second)); got != bin { |
| + if got := strings.TrimSpace(waitForFileContent(t, out, 5*time.Second)); got != bin { |
| t.Fatalf("$0 = %q; want the staged path %q, never live/%s", got, bin, host) |
| } |
| sum, err := release.FileSHA256(bin) |
| @@ -165,7 +165,7 @@ func TestExecBackendWorkerRecycleExecsTheCapturedBuildAfterARepoint(t *testing.T |
| t.Fatalf("recycle onto v1: %v", err) |
| } |
| defer p2.Stop(context.Background()) |
| - if got := strings.TrimSpace(waitForFile(t, out1, 5*time.Second)); got != bin1 { |
| + if got := strings.TrimSpace(waitForFileContent(t, out1, 5*time.Second)); got != bin1 { |
| t.Fatalf("recycle exec'd %q, want the captured %q", got, bin1) |
| } |
| if id2 != id1 { |