Update Harbor client and gateway integration workflows
This commit is contained in:
@@ -109,6 +109,9 @@ function createHarness(overrides = {}) {
|
||||
events.push('operation');
|
||||
return operation();
|
||||
},
|
||||
restoreAppliedActivation: overrides.restoreAppliedActivation
|
||||
? async (previousState) => overrides.restoreAppliedActivation(previousState, events)
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -246,6 +249,24 @@ test('route rules rollback continues and classifies runtime restore failure', as
|
||||
assert.ok(broken.events.filter((event) => event === 'state.update').length >= 1);
|
||||
});
|
||||
|
||||
test('route rules rollback restores the previous reserve selector', async () => {
|
||||
const state = canonicalState();
|
||||
state.appliedFailoverPolicy = {
|
||||
primary: { profileId: 'primary', serverId: 'other' },
|
||||
reserve: { profileId: 'primary', serverId: 'server' },
|
||||
};
|
||||
const harness = createHarness({
|
||||
state,
|
||||
failures: { stateUpdates: [{ after: new Error('state') }] },
|
||||
restoreAppliedActivation: async (previousState, events) => {
|
||||
assert.equal(previousState.appliedServerId, 'server');
|
||||
events.push('selector.reserve');
|
||||
},
|
||||
});
|
||||
await assert.rejects(harness.service.update(newRules, 2, 2), /state/);
|
||||
assert.ok(harness.events.indexOf('selector.reserve') > harness.events.indexOf('runtime.restore'));
|
||||
});
|
||||
|
||||
test('route rules route preserves one adapter and state-only response', async () => {
|
||||
const calls = [];
|
||||
const route = createRouteRulesRoute({
|
||||
@@ -260,5 +281,6 @@ test('route rules route preserves one adapter and state-only response', async ()
|
||||
|
||||
const source = readFileSync(new URL('../../src/server/index.ts', import.meta.url), 'utf8');
|
||||
assert.match(source, /createRouteRulesRoute\(\{/);
|
||||
assert.match(source, /state\.appliedFailoverPolicy[\s\S]*buildFailoverCandidate\(\{ \.\.\.state, routeRules \}, 'applied'\)\.config/);
|
||||
assert.doesNotMatch(source, /function applyRouteRules|req\.url === ['"]\/api\/route-rules['"]/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user