Update Harbor client and gateway integration workflows
This commit is contained in:
@@ -8,7 +8,7 @@ import { deviceId } from '../../dist/server/services/deviceInventoryService.js';
|
||||
|
||||
const mac = '00:11:22:33:44:55';
|
||||
const id = deviceId(mac);
|
||||
const device = { ip: '192.168.50.7', mac };
|
||||
const device = { ip: '192.168.50.7', mac, alias: 'MacBook' };
|
||||
const connection = (connectionId, type, host, upload, download, sourceIP = device.ip, chains = ['vpn-out']) => ({
|
||||
id: connectionId,
|
||||
metadata: { type, host, sourceIP },
|
||||
@@ -205,3 +205,36 @@ test('domain classification normalizes known services and rejects IP or malforme
|
||||
assert.equal(classifyDomain('192.0.2.1'), null);
|
||||
assert.equal(classifyDomain('broken_label.example'), null);
|
||||
});
|
||||
|
||||
test('failover activity is zero-work while disabled and uses the existing connection poll', async () => {
|
||||
let observedAt = new Date('2026-08-19T10:00:00.000Z');
|
||||
let response = { connections: [
|
||||
connection('work', 'tproxy/tproxy-in', 'r1.googlevideo.com', 0, 0, device.ip, ['channel-primary', 'channel-selector']),
|
||||
connection('probe', 'mixed/diagnostics-primary-in', 'youtube.com', 0, 10_000, device.ip, ['channel-primary']),
|
||||
] };
|
||||
const service = createDomainTrafficService({
|
||||
observe: async () => response,
|
||||
devices: () => [device],
|
||||
now: () => observedAt,
|
||||
});
|
||||
|
||||
await service.refresh();
|
||||
assert.equal(service.activitySnapshot(100), null);
|
||||
service.enableActivity();
|
||||
observedAt = new Date('2026-08-19T10:00:02.000Z');
|
||||
response.connections[0].download = 2_000;
|
||||
response.connections[1].download = 99_000;
|
||||
await service.refresh();
|
||||
const active = service.activitySnapshot(500);
|
||||
assert.equal(active.state, 'active');
|
||||
assert.equal(active.totalBytesPerSecond, 1_000);
|
||||
assert.equal(active.transmittingConnections, 1);
|
||||
assert.equal(active.blockers[0].device, 'MacBook');
|
||||
assert.equal(active.blockers[0].service, 'YouTube');
|
||||
|
||||
observedAt = new Date('2026-08-19T10:00:14.000Z');
|
||||
await service.refresh();
|
||||
assert.equal(service.activitySnapshot(500).state, 'quiet');
|
||||
service.disableActivity();
|
||||
assert.equal(service.activitySnapshot(500), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user