Skip to content

test(generate): make actionlint normalization test hermetic - #444

Merged
joshua-temple merged 1 commit into
mainfrom
test/hermetic-actionlint-land
Jul 4, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
test/hermetic-actionlint-land

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

TestNormalizeWorkflowPath_ActionlintClean invoked actionlint on a generated orchestrate.yaml that references sibling reusable workflows the test never wrote, so actionlint could not resolve them and the test failed when run from the repo root. A test that depends on files outside its own temp dir gives false signal and can mask a real generator regression.

Fix

Make the test self-contained: write the referenced reusable workflow files into the temp tree before invoking actionlint so the check resolves its siblings.

Verification

go build ./..., go test ./... -race -count=1, and golangci-lint run ./... all clean locally.

The actionlint normalization test staged sibling callback stubs into its
temp dir but never anchored actionlint's project root there. actionlint
resolves ./-prefixed reusable-workflow references relative to the nearest
ancestor .git directory, so when the temp tree was not anchored it walked
up to an unrelated repository (or found none) and silently skipped local
reusable-workflow resolution. The staged stubs were ignored and the
generated uses: references went unvalidated, letting the test pass for the
wrong reason and mask a generator regression.

Anchor the project root with a bare .git marker in the temp tree so
resolution is self-contained regardless of where TMPDIR lives, declare the
environment workflow_call input the generator wires into every reusable
call so resolved references validate cleanly, and add a negative-control
test that proves reusable-workflow resolution is genuinely active.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit ee38f6b into main Jul 4, 2026
18 checks passed
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.

1 participant