Update Harbor client and gateway functionality
This commit is contained in:
@@ -27,6 +27,10 @@ const storedProfile = (servers = [server]) => ({
|
||||
lastRefreshAttemptAt: null,
|
||||
lastRefreshErrorCode: null,
|
||||
});
|
||||
const routeRules = [
|
||||
{ type: 'domain', value: 'api.example.com', enabled: true, outbound: 'vpn' },
|
||||
{ type: 'domain_suffix', value: 'example.com', enabled: true, outbound: 'direct' },
|
||||
];
|
||||
const canonicalState = (profiles = [storedProfile()]) => ({
|
||||
revision: 10,
|
||||
profiles,
|
||||
@@ -34,8 +38,8 @@ const canonicalState = (profiles = [storedProfile()]) => ({
|
||||
appliedProfileId: profiles[0]?.id || '',
|
||||
appliedServerId: profiles[0]?.desiredServerId || '',
|
||||
appliedServerSnapshot: profiles[0]?.servers[0] || null,
|
||||
routeRules: [],
|
||||
appliedRouteRules: [],
|
||||
routeRules,
|
||||
appliedRouteRules: routeRules,
|
||||
routeRulesRevision: 0,
|
||||
gatewayAutoEnabled: true,
|
||||
});
|
||||
@@ -277,6 +281,18 @@ test('gateway-auto startup writes candidate config before publication without ap
|
||||
'state.update',
|
||||
'route:gateway-direct',
|
||||
]);
|
||||
assert.deepEqual(harness.snapshot().state.appliedRouteRules, routeRules);
|
||||
});
|
||||
|
||||
test('gateway-auto running transitions publish the rules actually present in each mode', async () => {
|
||||
const harness = createHarness({ running: true });
|
||||
await harness.service.refresh();
|
||||
assert.equal(harness.snapshot().gatewayAuto.mode, 'gateway-direct');
|
||||
assert.deepEqual(harness.snapshot().state.appliedRouteRules, []);
|
||||
|
||||
await harness.service.setEnabled(false);
|
||||
assert.equal(harness.snapshot().gatewayAuto.mode, 'local-vpn');
|
||||
assert.deepEqual(harness.snapshot().state.appliedRouteRules, routeRules);
|
||||
});
|
||||
|
||||
test('gateway loss safely stops when the applied server disappeared from refreshed config', async () => {
|
||||
|
||||
Reference in New Issue
Block a user