test(ql3): expose cutover reconciliation result

This commit is contained in:
whyour
2026-08-31 00:25:30 +08:00
parent 4b0241f992
commit b172ff5e02
2 changed files with 12 additions and 0 deletions
@@ -268,6 +268,8 @@ EOF
chmod 0600 "$rehearsal_root/commands/target-start.json" chmod 0600 "$rehearsal_root/commands/target-start.json"
phase 'start exact target container' phase 'start exact target container'
run_deploy cutover-target-start target-start.json target-start.result.json run_deploy cutover-target-start target-start.json target-start.result.json
printf '%s' 'QingLong Local Alpha target-start result: ' >&2
sed -n '1p' "$rehearsal_root/results/target-start.result.json" >&2
grep -q '"state":"target_active"' "$rehearsal_root/results/target-start.result.json" || fail 'target did not become active' grep -q '"state":"target_active"' "$rehearsal_root/results/target-start.result.json" || fail 'target did not become active'
stop_ms=$((start_ms + 1)) stop_ms=$((start_ms + 1))
sed "s/\"operation\":\"local.deployment.cutover.target-start\"/\"operation\":\"local.deployment.cutover.target-stop\"/;s/\"requestedAtMs\":$start_ms/\"requestedAtMs\":$stop_ms/" \ sed "s/\"operation\":\"local.deployment.cutover.target-start\"/\"operation\":\"local.deployment.cutover.target-stop\"/;s/\"requestedAtMs\":$start_ms/\"requestedAtMs\":$stop_ms/" \
@@ -276,6 +278,8 @@ sed "s/\"operation\":\"local.deployment.cutover.target-start\"/\"operation\":\"l
chmod 0600 "$rehearsal_root/commands/target-stop.json" chmod 0600 "$rehearsal_root/commands/target-stop.json"
phase 'stop target and prove rollback candidate' phase 'stop target and prove rollback candidate'
run_deploy cutover-target-stop target-stop.json target-stop.result.json run_deploy cutover-target-stop target-stop.json target-stop.result.json
printf '%s' 'QingLong Local Alpha target-stop result: ' >&2
sed -n '1p' "$rehearsal_root/results/target-stop.result.json" >&2
grep -q '"reconciliation":"rollback_candidate"' "$rehearsal_root/results/target-stop.result.json" || fail 'target stop did not produce a clean rollback candidate' grep -q '"reconciliation":"rollback_candidate"' "$rehearsal_root/results/target-stop.result.json" || fail 'target stop did not produce a clean rollback candidate'
[ "$(sha256sum "$legacy_root/db/database.sqlite" | sed 's/ .*//')" = "$legacy_sha256" ] || fail 'legacy database changed during rehearsal' [ "$(sha256sum "$legacy_root/db/database.sqlite" | sed 's/ .*//')" = "$legacy_sha256" ] || fail 'legacy database changed during rehearsal'
@@ -264,6 +264,14 @@ test('materializes and offline-audits one closed two-image trial kit', (t) => {
new RegExp(`phase '${phase}'`), new RegExp(`phase '${phase}'`),
); );
} }
assert.match(
cutoverRehearsalContents,
/QingLong Local Alpha target-start result:/,
);
assert.match(
cutoverRehearsalContents,
/QingLong Local Alpha target-stop result:/,
);
const report = auditLocalAlphaTrialKit({ bundleRoot: paths.outputRoot }); const report = auditLocalAlphaTrialKit({ bundleRoot: paths.outputRoot });
assert.equal(report.compatible, true); assert.equal(report.compatible, true);
assert.equal(report.sourceRevision, revision); assert.equal(report.sourceRevision, revision);