test(ha-entity-snapshots): RED tests for job checkpoint content (task 2.1)
Three tests against the current sentinel-only write_snapshot/load_snapshot: job content round-trip and concurrent-mutation-not-torn genuinely FAIL (RED) since no entity content is written today; write-failure-discard already passes (write_snapshot's open()-failure path already discards correctly) -- flagged transparently as a GREEN-from-day-one regression guard rather than faked RED, per real fault injection (directory removal -> genuine ENOENT). Carries forward two notes for task 2.2: fdatasync's return value is currently unchecked in write_snapshot (persist.c:1505), and a mid-encode- loop fault-injection test should be added once the per-job encode loop exists. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JDYFbrgyDHbvNYcxApKhrX
This commit is contained in:
parent
10f9bbfd9d
commit
0f344da89a
2 changed files with 287 additions and 1 deletions
|
|
@ -11,7 +11,7 @@
|
|||
- _Requirements: 1.1, 2.1_
|
||||
|
||||
- [ ] 2. Core: entity-bearing checkpoint write path — jobs
|
||||
- [ ] 2.1 RED: job checkpoint content, consistency, and failure-discard tests
|
||||
- [x] 2.1 RED: job checkpoint content, consistency, and failure-discard tests
|
||||
- Assert a checkpoint containing N jobs round-trips through load with all N job records
|
||||
field-identical
|
||||
- Assert a job actively transitioning state on a concurrent thread during the checkpoint walk
|
||||
|
|
@ -125,3 +125,5 @@
|
|||
|
||||
## Implementation Notes
|
||||
- (1.1) Test fixture `snapent_make`/`snapent_teardown` lives in `test_persist_snapshot_entities.c`; seeded jobs currently carry only jobid+state+an all-zeroed submit. Task 2.1's "field-identical round-trip" assertion needs richer submit-payload seeding (e.g. non-zero cmdline/user/queue in `xce_job_submit_t`) to be a meaningful field-by-field comparison — extend `snapent_seed_jobs`, do not re-seed separately.
|
||||
- (2.1) `write_snapshot`'s existing `fdatasync(fd)` call (persist.c:1505) does not check its return value at all — task 2.2 must fix this while adding entity encoding, since design.md's error-handling contract ("any failure at any step -- encode, write, sync -- leaves no file at the final path") requires it.
|
||||
- (2.1) The write-failure-discard test (`test_snapent_checkpoint_write_failure_leaves_no_final_file`) only exercises the pre-existing `open()`-failure branch (via directory removal) and passes today without any entity-encode loop existing yet. Task 2.2 should add a genuine mid-encode-loop fault-injection test (failing to encode e.g. the Nth of N jobs) once the per-job encode loop exists — the current test cannot validate that path.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue