tests: swap fixture waits for off-goroutine generations writers
Fixes the recurring TestARetiredRunsFailedStopIsSettledBySweeps flake: the swap fixture's cleanup now waits for in-flight sidecar restarts and the Service's background work before TempDir removal. Test-only change. Review: controller check; CI green at 2de5c4301. Squashed onto moved main (no conflict, go vet clean on the merged tree). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from fix/retired-runs-flake into main.
1 file changed,
+9
−0
internal/activator/swap_fixture_test.go+9 −0
CI cancelled — superseded by a newer push — run details
CI log
=== gate === go: downloading go1.26.10 (linux/arm64) go version go1.26.10 linux/arm64 opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1 tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz tofu: downloaded, digest verified aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip aws: downloaded, digest verified archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip archive: downloaded, digest verified installed in /tmp/carlos-opentofu-Ku8HRs .amadan/test-gate.sh go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0 go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0 go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5 go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0 go: downloading github.com/aws/smithy-go v1.28.1 go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e go: downloading golang.org/x/net v0.62.0 go: downloading modernc.org/sqlite v1.55.0 go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0 go: downloading github.com/prometheus/client_golang v1.17.0 go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0 go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0 go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2 go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0 go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1 go: downloading golang.org/x/sys v0.49.0 go: downloading golang.org/x/crypto v0.58.0 go: downloading github.com/oschwald/maxminddb-golang v1.13.1 go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6 go: downloading github.com/pion/logging v0.2.4 go: downloading github.com/pion/stun/v3 v3.1.5 go: downloading github.com/pion/turn/v4 v4.1.4 go: downloading github.com/pierrec/lz4/v4 v4.1.22 go: downloading google.golang.org/protobuf v1.36.10 go: downloading github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 go: downloading github.com/pion/dtls/v3 v3.1.4 go: downloading github.com/pion/transport/v4 v4.0.2 go: downloading github.com/pion/randutil v0.1.0 go: downloading github.com/klauspost/compress v1.20.2 go: downloading github.com/wlynxg/anet v0.0.5 go: downloading golang.org/x/text v0.43.0 go: downloading github.com/klauspost/compress v1.20.2 go: downloading modernc.org/sqlite v1.55.0 go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0 go: downloading github.com/pierrec/lz4/v4 v4.1.22 go: downloading modernc.org/libc v1.74.1 go: downloading modernc.org/libc v1.74.1 go: downloading modernc.org/memory v1.11.0 go: downloading github.com/google/uuid v1.6.0 go: downloading modernc.org/mathutil v1.7.1 go: downloading github.com/dustin/go-humanize v1.0.1 go: downloading github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec amadan: job cancelled — a newer push superseded it
diff --git a/internal/activator/swap_fixture_test.go b/internal/activator/swap_fixture_test.go| index 493dc94fb..5e5828381 100644 |
| --- a/internal/activator/swap_fixture_test.go |
| +++ b/internal/activator/swap_fixture_test.go |
| @@ -283,6 +283,15 @@ func newSwapFixtureOn(t *testing.T, wrap func(*fakeSwapBackend) Backend) *swapFi |
| a.now = clk.now |
| a.genHealth = func(context.Context, Gen) error { return nil } |
| f := &swapFixture{a: a, b: b, clk: clk, reg: reg, host: "swap.example.com"} |
| + // A run's settle (its proof's republication, after provenSettled is |
| + // already true) and a sweep's sidecar restart (its recordBuild) write |
| + // the generations file off the test's goroutine; both finish before |
| + // the test's TempDirs go, which a cleanup registered here precedes |
| + // (#897). Nothing sweeps after the test, so nothing starts another. |
| + t.Cleanup(func() { |
| + waitFor(t, "the sidecar restart in flight", func() bool { return a.sidecarSettled(f.host) }) |
| + waitBackground(t, a) |
| + }) |
| // The route's socket and database live in the test's own directory, |
| // never the shared /tmp. |
| rt := testRoute(f.host) |