test(generate): add absolute byte-identical baseline gate for single-component output - #515
Merged
Merged
Conversation
…component output The prior single-component byte-identical checks are all relative oracles (regenerate and compare, so got and want move together): a template edit passes them all. This adds an absolute snapshot gate, TestByteIdenticalBaseline_SingleComponent, that asserts a realistic multi-env single-component manifest emits output byte-for-byte equal to committed golden fixtures, that the emitted and golden file sets match exactly, and that no components-keyed artifact appears. It reds on any single-component byte drift (proven both by flipping a golden byte and by hiding one). Test and fixtures only; no production change. Regenerate with -update. Refs #285. 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
The single-component byte-identical invariant is the load-bearing guarantee of the monorepo campaign, but every existing check is a RELATIVE oracle (regenerate and compare, so
gotandwantmove together). A template edit that changes single-component output would pass all of them undetected.Fix
Add an ABSOLUTE snapshot gate,
TestByteIdenticalBaseline_SingleComponent(internal/generate/byte_identical_baseline_test.go). For a realistic multi-env single-component manifest (builds, deploys, external, promote, release-publish, hotfix, rollback) it asserts:internal/generate/testdata/byte_identical_baseline/,orchestrate-*.yaml, exactly oneorchestrate.yaml, no namespaced name, no top-levelcomponents:).It reds on any single-component byte drift, proven both by flipping a golden byte and by hiding a golden. Regenerate with
-update.Test and fixtures only; no production change.
Verification
go build ./...,go test ./...(2562 pass),go test ./... -race(2562 pass),golangci-lint run ./...clean.Refs #285.