test: startup wiring witness follows agentBootPass
655fa96e moved runAgent's worker boot pass into agentBootPass for the code-health ratchet. TestRunAgentStartupWiring now finds the goroutine that calls agentBootPass and checks the helper runs the boot pass on both paths (managed on admission, BYO directly). Test-only; no census change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+17
−5
internal/host/startup_largebox_linux_test.go+17 −5
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-NfmzSY .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/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 github.com/benbjohnson/litestream v0.5.14 go: downloading github.com/superfly/ltx v0.5.1 go: downloading golang.org/x/net v0.62.0 go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0 go: downloading modernc.org/sqlite v1.55.0 go: downloading github.com/aws/aws-sdk-go-v2/config v1.32.6 go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0 go: downloading golang.org/x/sys v0.49.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/sns v1.43.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 golang.org/x/crypto v0.58.0 go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1 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/aws/aws-sdk-go-v2/service/ssm v1.74.0 go: downloading github.com/pierrec/lz4/v4 v4.1.22 go: downloading github.com/klauspost/compress v1.20.2 go: downloading github.com/pion/transport/v4 v4.0.2 go: downloading github.com/pion/dtls/v3 v3.1.4 go: downloading github.com/pion/randutil v0.1.0 go: downloading golang.org/x/text v0.43.0 go: downloading golang.org/x/sync v0.24.0 go: downloading github.com/prometheus/client_golang v1.17.0 go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18 go: downloading github.com/lmittmann/tint v1.1.3 go: downloading github.com/wlynxg/anet v0.0.5 go: downloading github.com/beorn7/perks v1.0.1 go: downloading github.com/prometheus/common v0.45.0 go: downloading github.com/prometheus/procfs v0.12.0 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/klauspost/compress v1.20.2 go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e 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 google.golang.org/protobuf v1.36.10 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 modernc.org/mathutil v1.7.1 amadan: job cancelled — a newer push superseded it
diff --git a/internal/host/startup_largebox_linux_test.go b/internal/host/startup_largebox_linux_test.go| index d1dc89adf..472f37d99 100644 |
| --- a/internal/host/startup_largebox_linux_test.go |
| +++ b/internal/host/startup_largebox_linux_test.go |
| @@ -402,12 +402,12 @@ func TestRunAgentStartupWiring(t *testing.T) { |
| key = types.ExprString(fd.Recv.List[0].Type) + "." + key |
| } |
| switch key { |
| - case "runAgent", "startActivator", "recoverLayoutAtStart", "activatorStart.Run", "joinAgentShutdown": |
| + case "runAgent", "startActivator", "recoverLayoutAtStart", "activatorStart.Run", "joinAgentShutdown", "agentBootPass": |
| decls[key] = fd |
| } |
| } |
| } |
| - for _, key := range []string{"runAgent", "startActivator", "recoverLayoutAtStart", "activatorStart.Run", "joinAgentShutdown"} { |
| + for _, key := range []string{"runAgent", "startActivator", "recoverLayoutAtStart", "activatorStart.Run", "joinAgentShutdown", "agentBootPass"} { |
| if decls[key] == nil { |
| t.Fatalf("%s not found in package host", key) |
| } |
| @@ -600,18 +600,30 @@ func TestRunAgentStartupWiring(t *testing.T) { |
| requireSteps(t, "recoverLayoutAtStart", decls["recoverLayoutAtStart"].Body, "Recover", "RestoreHolds") |
| // The worker boot pass waits on the latch or the startup context, then |
| - // lists and wakes. |
| + // lists and wakes. runAgent reaches it through agentBootPass (the |
| + // managed/BYO split, internal/host/managedagent.go), which must run it on |
| + // both paths: once on admission for a managed box, directly for BYO. |
| var bootPass *ast.FuncLit |
| ast.Inspect(runAgent, func(n ast.Node) bool { |
| if g, ok := n.(*ast.GoStmt); ok { |
| - if fl, ok := g.Call.Fun.(*ast.FuncLit); ok && hasCall(syncCalls(fl.Body), "runWorkerBootPassAfterAdmission") { |
| + if fl, ok := g.Call.Fun.(*ast.FuncLit); ok && hasCall(syncCalls(fl.Body), "agentBootPass") { |
| bootPass = fl |
| } |
| } |
| return true |
| }) |
| + passes := 0 |
| + ast.Inspect(decls["agentBootPass"].Body, func(n ast.Node) bool { |
| + if c, ok := n.(*ast.CallExpr); ok && calleeName(c) == "runWorkerBootPassAfterAdmission" { |
| + passes++ |
| + } |
| + return true |
| + }) |
| + if passes != 2 { |
| + t.Errorf("agentBootPass: runWorkerBootPassAfterAdmission called %d times, want 2 (managed on admission, BYO directly)", passes) |
| + } |
| if bootPass == nil { |
| - t.Error("runAgent: no goroutine runs runWorkerBootPassAfterAdmission") |
| + t.Error("runAgent: no goroutine runs the worker boot pass (agentBootPass)") |
| } else if !receivesFrom(bootPass.Body, "started") || !hasCall(syncCalls(bootPass.Body), "Done") { |
| t.Error("runAgent: the worker boot pass does not wait on started and startupCtx.Done") |
| } |