test(generate): make actionlint normalization test hermetic - #444
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestNormalizeWorkflowPath_ActionlintCleaninvoked actionlint on a generatedorchestrate.yamlthat 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, andgolangci-lint run ./...all clean locally.