Improve failover status feedback and controls
This commit is contained in:
@@ -295,6 +295,7 @@ test('an in-flight observation is discarded after failover is disabled', async (
|
||||
await testHarness.service.reconcile();
|
||||
const round = testHarness.service.runRound();
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
assert.equal(testHarness.service.snapshot().reason, 'checking-channels');
|
||||
await testHarness.service.save({ ...enabled, enabled: false });
|
||||
for (const probe of pending) probe.resolve({ vpn: { sites: [{ status: probe.role === 'reserve' ? 'available' : 'unavailable' }] } });
|
||||
await round;
|
||||
@@ -320,6 +321,27 @@ test('one channel probe failure does not erase the other channel health', async
|
||||
await testHarness.service.checkNow();
|
||||
assert.equal(testHarness.service.snapshot().primary.health, 'unknown');
|
||||
assert.equal(testHarness.service.snapshot().reserve.health, 'healthy');
|
||||
assert.notEqual(testHarness.service.snapshot().reason, 'checking-channels');
|
||||
});
|
||||
|
||||
test('manual check exposes both in-flight channel roles and clears them after completion', async () => {
|
||||
const pending = [];
|
||||
const testHarness = harness(serviceState(), {
|
||||
dataplane: {
|
||||
checkConfig: async () => ({}),
|
||||
runFailoverProbe: (role) => new Promise((resolve) => pending.push({ role, resolve })),
|
||||
readFailoverSelector: async () => ({ role: 'primary' }),
|
||||
selectFailoverRole: async (role) => ({ role }),
|
||||
setFailoverActivityEnabled: async () => {},
|
||||
readFailoverActivity: async () => ({ activity: { state: 'quiet', observedAt: new Date().toISOString() } }),
|
||||
},
|
||||
});
|
||||
const check = testHarness.service.checkNow();
|
||||
await new Promise(setImmediate);
|
||||
assert.equal(testHarness.service.snapshot().reason, 'checking-channels');
|
||||
for (const probe of pending) probe.resolve({ vpn: { sites: [{ status: 'available' }] } });
|
||||
await check;
|
||||
assert.notEqual(testHarness.service.snapshot().reason, 'checking-channels');
|
||||
});
|
||||
|
||||
test('monitoring wakes at an earlier decision deadline instead of waiting a full interval', async () => {
|
||||
|
||||
Reference in New Issue
Block a user