Improve failover controls and preserve manual switching state
Build and Deploy Gateway / build-and-push (push) Failing after 1s
Build and Deploy Gateway / deploy (push) Has been skipped

This commit is contained in:
2026-08-28 19:40:53 +03:00
parent 8f2f418569
commit a84cca0668
30 changed files with 547 additions and 112 deletions
+16 -6
View File
@@ -514,12 +514,22 @@ test('selector acknowledgement precedes state commit and a failed commit rolls s
assert.equal(state.appliedServerId, 'server-1');
});
test('manual selector and pause publish in one canonical commit', async () => {
const testHarness = harness(serviceState());
await testHarness.service.manualSwitch('reserve');
assert.equal(testHarness.read().appliedServerId, 'server-2');
assert.equal(testHarness.read().failoverPolicy.paused, true);
assert.equal(testHarness.calls.filter((call) => call === 'state:update').length, 1);
test('manual switch preserves automation and starts the configured reserve hold', async () => {
const now = new Date('2026-08-27T12:00:00.000Z');
for (const paused of [false, true]) {
const state = serviceState(normalizeFailoverPolicy({
...enabled,
paused,
minimumReserveMs: 300_000,
}));
const testHarness = harness(state, { now: () => now });
await testHarness.service.manualSwitch('reserve');
assert.equal(testHarness.read().appliedServerId, 'server-2');
assert.equal(testHarness.read().failoverPolicy.enabled, true);
assert.equal(testHarness.read().failoverPolicy.paused, paused);
assert.equal(testHarness.read().failoverRuntimeState.holdUntil, new Date(now.getTime() + 300_000).toISOString());
assert.equal(testHarness.calls.filter((call) => call === 'state:update').length, 1);
}
});
test('post-commit monitoring failure does not report a committed pause as failed', async () => {