test: define state_compute tests in a yaml file#6574
Conversation
WalkthroughAdds workspace-managed serde/serde_yaml/ahash deps, a build-time generator that parses a YAML manifest to emit per-chain/epoch state_compute test functions, and refactors hard-coded per-epoch tests to include and run those generated tests via a shared runner. Changes
Sequence Diagram(s)sequenceDiagram
participant Build as Build Script (build.rs)
participant FS as Filesystem (src/state_manager/state_compute_tests.yaml)
participant Generator as Generated Tests (OUT_DIR/__state_compute_tests_gen.rs)
participant TestRunner as Test code (utils.rs)
participant Cargo as Cargo Test Harness
Build->>FS: read state_compute_tests.yaml
Build->>Build: deserialize YAML -> StateComputeTests
Build->>Generator: write generated test functions
Note right of Generator: emitted cargo_test_state_compute_{chain}_{epoch}()
TestRunner->>Generator: include! generated file at compile time
Cargo->>TestRunner: run tests (cargo test)
TestRunner->>TestRunner: call state_compute_test_run(chain, epoch)
TestRunner->>FS: (runtime) obtain snapshot / state data
TestRunner->>Cargo: report test results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
17ed8b8 to
6350790
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
Tests
Chores