-
Notifications
You must be signed in to change notification settings - Fork 34
Implement golden file testing for compiler output validation #3779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Created testdata directory structure (workflows/ and golden/) - Added testing_helpers.go with CompareGoldenFile function - Created 10 representative workflow examples covering various scenarios - Implemented compiler_golden_test.go with table-driven tests - Generated golden files for all test cases - Updated TESTING.md with golden file testing documentation - All tests pass with make test-unit Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot add makefile target to update golden file, document process
|
|
||
| ## Testing Structure | ||
|
|
||
| ### 1. Unit Tests (`pkg/*/`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move file to specs folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved golden file testing documentation to specs/golden-file-testing.md and updated TESTING.md to reference it (commit 8fdd9b8).
The specs file includes complete documentation on architecture, implementation, usage, and benefits. TESTING.md now has a streamlined quick reference section that links to the detailed spec.
- Added `make update-golden` target to Makefile for easy golden file updates - Created specs/golden-file-testing.md with complete documentation - Updated specs/README.md to include golden file testing spec - Simplified TESTING.md to reference the spec instead of duplicating content - All tests still pass Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added Usage: make update-goldenThe target runs the golden file tests with the |
Adds golden file testing pattern to validate compiler-generated YAML and catch regressions. Previously, compiler output was validated through manual inspection or brittle string matching.
Implementation
Testing infrastructure (
testing_helpers.go)CompareGoldenFile()helper with-update-goldenflag supportTest suite (
compiler_golden_test.go)Test coverage (
testdata/{workflows,golden})Makefile target (
make update-golden)Documentation (
specs/golden-file-testing.md)Usage
Tests execute in ~130ms total. Full documentation available in specs/golden-file-testing.md.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.