test(scheduler-snapshot-job-allocation): full cross-instance round-trip proof

Task 3.1: comprehensive integration test proving tasks 1.1/1.2/2.1/2.2
work together end to end -- a RUNNING job (multi-host, multi-resource,
plus a genuine shared-resource-pool component) and a PENDING job saved
together and loaded into a second, independent core. Asserts:

- Both jobs get a valid, non-NULL schedobj in the restored core.
- The running job's allocation/accounting content-match the source,
  including the shared-pool component.
- Worker resInUse and core sharedInUse, computed via the real
  sched_charge_account() chain (white-box included from resource.c,
  following the established test_resource_accounting.c/test.c
  link-only-stub convention), match exactly between source and
  restored cores -- the actual proof of Req 1.2/1.3, not just that
  job->accounts holds the right values.
- Destroying the source core's job list afterward does not corrupt or
  crash the restored core (Req 1.4's independence guarantee exercised
  via real teardown, not just pointer-distinctness checks).

Test-only task; no production code changed. Independently verified via
a live RED/GREEN toggle against task 2.2's load-side restoration block.

Requirements: 1.1, 1.2, 1.3, 1.4, 2.1, 2.3, 2.4
This commit is contained in:
Rongsong Shen 2026-08-27 15:22:04 +00:00
parent 182cb55574
commit 7481cedb3a
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 563 additions and 6 deletions

View file

@ -38,7 +38,7 @@
- _Boundary: snapshot load (allocation and accounting restoration)_
- [ ] 3. Integration: prove the save/load round trip end to end
- [ ] 3.1 Verify a full cross-instance save/load round trip preserves allocation, accounting, and scheduling representation together
- [x] 3.1 Verify a full cross-instance save/load round trip preserves allocation, accounting, and scheduling representation together
- Save a scheduler instance containing a mix of running jobs (spanning multiple hosts, multiple resources, and a shared-resource-pool allocation) and pending jobs, then load that saved state into a second, independent scheduler instance.
- Assert every running job's allocation and accounting match the source instance, every job (running or pending) has a valid scheduling representation, and that ending either instance's job list afterward does not corrupt or crash the other.
- Observable completion: the round-trip test passes, demonstrating the restored instance's resource-in-use totals exactly match what the source instance reported before saving.