Skip to content

test(ci): run the tests hidden behind the mage build tag - #385

Merged
FumingPower3925 merged 1 commit into
mainfrom
fix/384-run-mage-tagged-tests
Sep 15, 2026
Merged

FumingPower3925 merged 1 commit into
mainfrom
fix/384-run-mage-tagged-tests

Conversation

@FumingPower3925

Copy link
Copy Markdown
Contributor

Closes #384.

What was not running

go test ./... never compiles anything behind //go:build mage, so the tagged tests executed in no workflow at all. Counted on d0cb24c:

Lint compiles the magefiles, and the comment there explains why that gap was worth closing for compilation. The test half was never closed.

One concrete thing this was hiding: mage_bench_sutenv_test.go:294 pins schema_version to 5.13 and has never run. To be exact rather than dramatic — report/schema_test.go pins the same constant and does run, so the untagged suite is not blind to a bare constant change. What it is blind to is everything the tagged suite asserts about the shape the mage bench driver emits around that constant.

The change

A separate mage-tagged job running go test -count=1 -race -tags mage -timeout=10m ./..., added to ci-ok's needs.

  • ./..., not a package list. A tagged test dropped into a third package is then covered the moment it lands, instead of waiting for someone to widen an enumeration. That is the same failure mode that produced this issue.
  • A separate job, so it costs nothing on the critical path: the root module job is the long pole at 3 m 19 s (run 34961609126), and the tagged suite is 2 m 00 s.
  • In ci-ok's needs, because a job nobody fans in is a job branch protection cannot require — the tagged suite could otherwise go red without failing the one required check.

Guard, and its controls

workflow_mage_tests_run_test.go is untagged on purpose, so it runs in the root job rather than in the job it guards.

Control Injection Result
1 drop mage from ci-ok's needs guard FAILS — measured
2 narrow the command from ./... to . ./cmd/runner guard FAILS — measured
3 TestMageTaggedTestsStillExist over an empty set fails by construction; logs the 9 files it found

Every injection was diffed against a backup before the test ran, and reverted with cp.

What this PR does not yet claim

The discriminating measurement — that the new job catches a defect the old command cannot — is half done. I removed the strings.TrimSpace from resolveBenchCells in mage_tier.go and confirmed the old command go test -count=1 -race . passes against it (blind). The -tags mage arm did not complete: the host ran out of process slots mid-run, so it is absent, not a pass. I will post that arm's output here before this merges rather than let an unrun arm read as a green one.

`go test ./...` never compiled them, so fifty-two tests across nine
files executed in no workflow. What they cover is not peripheral: the
eleven //go:build mage source files are the bench driver, the release
gate, the cluster orchestration, publish and the validate targets, and
two of them pin the report schema version -- the constant a rebase has
already auto-merged to the wrong value once, silently, because both
sides wrote the same literal.

Lint compiles the magefiles, and its own comment explains why that gap
was worth closing for compilation. The test half was never closed.

The job runs over ./... rather than the two packages that carry mage
files today, so a tagged test dropped into a third package is covered
the moment it lands instead of waiting for someone to widen a list. It
is a separate job, so it costs nothing on the critical path: the root
module job is the long pole at three minutes and nineteen seconds, and
the tagged suite takes two minutes.

ci-ok gains the job in its needs list. A job nobody fans in is a job
branch protection cannot require, and the tagged suite could then go
red without failing the one required check.

The guard test is untagged on purpose, so it runs in the root job
rather than in the job it is guarding.
@FumingPower3925
FumingPower3925 force-pushed the fix/384-run-mage-tagged-tests branch from 666f9c2 to 2d9cbb0 Compare September 15, 2026 12:49
@FumingPower3925

Copy link
Copy Markdown
Contributor Author

The discriminating arm is done

Same tree, same injected defect, two commands. I replaced strings.TrimSpace(preset) with strings.ToLower(preset) in resolveBenchCells (mage_tier.go:268) — chosen so the strings import stays used, because dropping it produces a build error, which would prove nothing about whether a test catches the behaviour.

Old command — go test -count=1 -race .

ok  	github.com/goceleris/probatorium	1.775s

New command — go test -count=1 -race -tags mage .

--- FAIL: TestResolveBenchCellsPrecedence (0.00s)
    mage_bench_sutenv_test.go:107: blank preset: got ("  ",true) want ("*/*",false)
    mage_bench_sutenv_test.go:114: padded preset: got (" ws-large-echo/*,ws-echo/*,get-json/* ",true) want ("ws-large-echo/*,ws-echo/*,get-json/*",true)
FAIL

The injection was diffed against a backup before each run and reverted with cp; the restored file's SHA-256 matches the pre-injection copy exactly and git status is empty.

That closes the gap I flagged in the description. All three controls are now measured:

Control Injection Result
1 drop mage from ci-ok's needs guard FAILS
2 narrow the command from ./... to . ./cmd/runner guard FAILS
3 break resolveBenchCells old command passes, new command fails

Rebased

Rebased onto 02a0b67 (#378, schema 5.14). No conflicts — that PR touches nothing this one does.

Worth noting what #378 walked into: its third schema-version pin lives in mage_bench_sutenv_test.go, which is //go:build mage. Its author had to verify that pin by running the tagged suite by hand, because no workflow would have. After this lands, that pin is enforced by CI like the other two.

@FumingPower3925
FumingPower3925 merged commit d98e78d into main Sep 15, 2026
19 checks passed
@FumingPower3925
FumingPower3925 deleted the fix/384-run-mage-tagged-tests branch September 15, 2026 13:18
@FumingPower3925

Copy link
Copy Markdown
Contributor Author

Correcting a number in the description now that the job has run on a real runner.

I wrote that the tagged suite "takes two minutes" against the root module job's 3 m 19 s. That two minutes was measured on my laptop and I did not say so. On the GitHub runner, in run 34971111435:

  • mage-tagged5 m 23 s
  • root module5 m 27 s

So the two are effectively the same length, not a third of it. The conclusion is unchanged — the job runs in parallel, so it adds nothing to the critical path, and root module is still marginally the long pole — but the specific figure in the description was a local measurement presented as if it were the runner's.

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.

48 mage-tagged tests run in no CI workflow: the Lint job compiles magefiles but nothing executes their tests

1 participant