Skip to content

Make integration-tagged tests compile, and gate every build tag (#913) - #927

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/913
Oct 15, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
fix/913

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #913

What was broken

The root integration_test.go (//go:build integration) has not compiled since the initial release. make check and CI only vet the default build, so nothing noticed. Fixing the two errors in the issue was enough for it to compile:

  • config.LoadDefaultConfig → the package is imported as awsconfig
  • loadAWSConfig returned awsconfig.Config (an interface in the config package) where aws.Config was needed

Tests removed, and why

  • Scheduler tests (6) and their helpers. They exercise a scheduler that doesn't exist. They write parameter_file_key / execution_time / cron_expression, but the scheduler reads s3_params_key / schedule_expression (pkg/scheduler/types.go, lambda/scheduler-handler). They also "trigger" execution by editing next_execution_time in DynamoDB, but schedules fire from EventBridge Scheduler (pkg/scheduler.CreateSchedule), so nothing would ever run. Their inline param files use a pre-defaults:/params: format and set no TTL. One of them also read ../testdata/... from the repo root.
  • Queue tests (6), TestScheduledBatchQueue, TestMultiRegionResultCollection. Unconditional t.Skip placeholders.
  • make test-integration-scheduler / test-integration-queue. After the removals they matched no tests.
  • pkg/integration/orchestrator_test.go. The same deletion as Remove the stale orchestrator integration test, and gate module tidiness (#907) #914. It's needed here because the new gate vets the integration tag and that file can't build. The two deletions are identical, so git merges them cleanly.

Cost safety (CLAUDE.md): the surviving multi-region sweep tests launch real instances

  • TTL: already present. Every param file sets ttl: 30m.
  • Explicit terminate: was broken. cancelSweep ran spawn cancel without --yes. Cancel prompts before terminating, and with no answer on stdin it aborts with nothing terminated, so these tests' cleanup could never have worked. It now passes --yes. Cancel also used to be the last line of each test, so any t.Fatalf before it skipped it. It now runs from a t.Cleanup that launchSweep registers as soon as it has the sweep ID.
  • Leak-check: was absent. The same cleanup now polls EC2 directly for 3 minutes, in every region the param file names. It looks for tag:spawn:sweep-id=<id> in pending/running/stopping/stopped, terminates anything it finds, and fails the test. It polls rather than checking once because the orchestrator Lambda can still launch between the cancel and its next check of the cancel flag. The region set is parsed from the param file before launching, and the test is fatal if that finds no region.
  • make test-integration now depends on build (the tests exec ./bin/spawn) and runs -count=1 (All four e2e make targets omit -count=1, so a cached pass can certify a binary that does nothing #831's runtime-binary cache problem).
  • pkg/integration/hybrid_test.go launches no instances (local provider + DynamoDB registry, with defer Deregister). The e2e tier 1–3 files already have test/e2e/reaper.go.

None of these tests were executed. Everything here was compiled and vetted only.

Gate

scripts/check-build-tags.sh:

  • Modules: found with the same find as check-tidy.sh / nested-modules.sh. The script exits 1 if ./go.mod isn't among them.
  • Tags: found per module from //go:build lines, not from a list. The only names dropped are the toolchain's own: GOOS/GOARCH from go tool dist list, plus unix, cgo, gc, gccgo, ignore, goN.M and goexperiment.*. Found today, all in the root module: e2e_tier0, e2e_tier1, e2e_tier2, e2e_tier3, integration (31 files). The script exits 1 if no module has any custom tag.
  • Check: go vet -tags <tag> ./... in that module for each tag. Nothing is executed.
  • Coverage check: every custom-tagged file must appear in go list -tags <tag> output for at least one tag. A file that only builds under a combination (a && b), or under a tag plus another GOOS, fails the gate by name instead of being skipped silently.
  • Wiring: make check-build-tags, step 6 of make check, and the CI step "Build-tag compile gate". It takes about 8 s locally.

Watched it fail (exit 1), then restored, against each of these:

  1. the original config.LoadDefaultConfig bug put back: undefined: config
  2. the original awsconfig.Config return type put back: cfg.Region undefined (type ...config.Config has no field or method Region)
  3. orchestrator_test.go restored: no required module provides package .../pkg/orchestrator
  4. a new //go:build newtag913 file with a type error: the new tag is found and vetted, and the gate fails
  5. an integration-tagged broken file in lambda/ttl-reaper: the nested module is vetted and the gate fails
  6. a //go:build integration && e2e_tier0 file: the coverage check names it
  7. run in a module with no tags: "found no custom build tags"; run in a dir with no go.mod: "did not find ./go.mod"

Conflict with #914

Both PRs add step 6 to make check and a new target after check-nested in the Makefile, and both add a new step after "Nested modules" in ci.yml. Expect a small textual conflict in both files. Resolve it by keeping both: make one of the make check steps 7, and keep both targets and both CI steps. The orchestrator_test.go deletion is identical in both PRs and won't conflict. CHANGELOG.md may also need make changelog-fix if both add ### Fixed.

Local make check

Everything passes except the known Docker-only TestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker. make check stops at that step, so check-nested (9 modules) and check-build-tags were run separately, and both pass.

Filed while here

The root integration_test.go had not compiled since the initial release:
`config.LoadDefaultConfig` with the package imported as awsconfig, and
loadAWSConfig declared to return the awsconfig.Config interface instead of
aws.Config. Nothing in make check or CI vetted the integration tag, so it went
unseen. pkg/integration/orchestrator_test.go (#907, the deleted orchestrator)
is removed here as well, identically to #914, so the new gate passes either way.

The scheduler tests are removed. They wrote parameter_file_key/execution_time/
cron_expression items, which the scheduler has never read (it reads
s3_params_key/schedule_expression), and waited for execution to follow a
DynamoDB edit, but schedules fire from EventBridge Scheduler. Their inline param
files used a pre-defaults/params format and set no TTL. The queue tests and
the result-collection test were t.Skip placeholders. The make targets that ran
only those tests are removed.

The surviving multi-region sweep tests launch real instances and now meet the
cost-safety rule. cancelSweep passes --yes: without it, cancel prompted, read
EOF and terminated nothing. Cancel runs from a t.Cleanup registered at launch,
so a mid-test t.Fatalf can't skip it. A leak-check then polls EC2 directly in
every region the param file names, terminates anything still tagged with the
sweep ID, and fails the test. test-integration builds bin/spawn first and runs
-count=1.

scripts/check-build-tags.sh discovers custom tags from //go:build lines per
module and runs `go vet -tags <tag> ./...` for each; nothing is executed. It
fails when no tag is found anywhere, and when a tagged file was compiled by no
single-tag run (a combination such as `a && b`). Wired in as make
check-build-tags, step 6 of make check, and a CI step.
@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit d8fdfd1 into main Oct 15, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/913 branch October 15, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Root integration_test.go has never compiled; make test-integration cannot build the root package

1 participant