test: Introduce lockfile to all Scenario tests#238
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds first-class lockfile support to scenario dynamic test projects, allowing tests to generate and update component lockfiles via helpers instead of handwritten TOML strings.
Changes:
- Introduces
projecttest.AddLock(...)(serialize-time) andprojecttest.WriteLock(...)(post-serialize updates) utilities for scenario fixtures. - Extends
dynamicTestProjectto track and serialize component lockfiles (including when initializing a git repo). - Updates scenario tests and testing guidance to use the new lock helpers.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scenario/testdata/simple/locks/a.lock | Adds a basic lockfile fixture used by simple scenario testdata. |
| scenario/internal/projecttest/lockfile_test.go | Adds unit tests validating lock serialization, updating, and conflict handling. |
| scenario/internal/projecttest/lockfile.go | Adds lockfile option helpers and filesystem writing helpers for scenario projects. |
| scenario/internal/projecttest/dynamictestproject.go | Adds lock tracking/serialization to dynamic test projects and prevents AddFile/AddLock path conflicts. |
| scenario/component_render_test.go | Switches render scenario fixtures from raw lockfile strings to AddLock. |
| scenario/component_query_test.go | Adds a lockfile to the query scenario fixture via AddLock. |
| scenario/component_changed_test.go | Replaces ad-hoc lockfile string writes with projecttest.WriteLock helper. |
| scenario/component_build_test.go | Adds a lockfile to the build scenario fixture via AddLock. |
| .github/instructions/testing.instructions.md | Documents how to create lock files in unit tests vs scenario fixtures. |
a6970ed to
0fcc563
Compare
0fcc563 to
796cce0
Compare
There was a problem hiding this comment.
✅ Ready to approve
The changes are localized to test infrastructure and scenario fixtures, and the new helpers are covered by targeted unit tests and integrated consistently across the updated scenario tests.
Note: this review does not count toward required approvals for merging.
Copilot's findings
- Files reviewed: 8/9 changed files
- Comments generated: 0 new
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
862118b to
cc6a43a
Compare
This pull request refactors how lock files are created and managed in scenario and unit tests, improving test readability and consistency. It introduces helper functions to simplify lock file creation, updates documentation to reflect these changes, and replaces manual lock file writing with the new helpers throughout the test suite.
Test infrastructure improvements:
writeLockInDirhelper inscenario/component_changed_test.goto simplify writing lock files in scenario tests, replacing manual file creation with a single function call.localComponentLockhelper inscenario/component_render_test.gofor consistent lock file creation in component render tests.dynamicTestProjectinprojecttest/dynamictestproject.goto maintain a map of lock files, enabling programmatic lock file management and serialization. [1] [2]