Update Harbor client and gateway functionality
Build and Deploy Gateway / build-and-push (push) Successful in 35s
Build and Deploy Gateway / deploy (push) Successful in 14s

This commit is contained in:
2026-08-17 15:23:16 +03:00
parent 0b39211fbd
commit 7c255192b0
41 changed files with 1443 additions and 218 deletions
+18 -2
View File
@@ -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 () => {