test: Introduce lockfile to all Scenario tests#238
Open
Tonisal-byte wants to merge 2 commits into
Open
Conversation
Contributor
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. |
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.
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]