Implement Harbor gateway device ecosystem support
This commit is contained in:
@@ -41,7 +41,7 @@ test('device controller preserves Gateway-only polling, monotonic publication an
|
||||
assert.match(page, /<GatewayTrafficSummary feature=\{devicesFeature\} now=\{now\}/);
|
||||
});
|
||||
|
||||
test('all unknown inventory results pass one identity-preserving runtime parser', () => {
|
||||
test('all unknown inventory results pass one capability-aware runtime parser', () => {
|
||||
const observedAt = '2026-08-08T12:34:56.000Z';
|
||||
const valid = {
|
||||
revision: 3,
|
||||
@@ -106,7 +106,21 @@ test('all unknown inventory results pass one identity-preserving runtime parser'
|
||||
},
|
||||
extra: { retained: true },
|
||||
};
|
||||
assert.equal(parseDeviceSnapshot(valid), valid);
|
||||
const oldBackend = parseDeviceSnapshot(valid);
|
||||
assert.equal(oldBackend.taggingSupported, false);
|
||||
assert.deepEqual(oldBackend.tags, []);
|
||||
assert.deepEqual(oldBackend.devices[0].tagIds, []);
|
||||
assert.deepEqual(oldBackend.extra, valid.extra);
|
||||
|
||||
const supported = {
|
||||
...valid,
|
||||
tags: [{ id: 'tag_0123456789abcdef', name: 'Умный дом' }],
|
||||
devices: [{ ...valid.devices[0], tagIds: ['tag_0123456789abcdef'] }],
|
||||
};
|
||||
const parsedSupported = parseDeviceSnapshot(supported);
|
||||
assert.equal(parsedSupported.taggingSupported, true);
|
||||
assert.deepEqual(parsedSupported.tags, supported.tags);
|
||||
assert.deepEqual(parsedSupported.devices[0].tagIds, ['tag_0123456789abcdef']);
|
||||
for (const invalid of [
|
||||
null,
|
||||
{},
|
||||
@@ -134,6 +148,10 @@ test('all unknown inventory results pass one identity-preserving runtime parser'
|
||||
{ ...valid, devices: [{ ...valid.devices[0], outboundTraffic: { observedAt, vpnBytes: '1' } }] },
|
||||
{ ...valid, devices: [{ ...valid.devices[0], outboundTraffic: { ...valid.devices[0].outboundTraffic, directIpv4ObservedAt: 'not-a-date' } }] },
|
||||
{ ...valid, devices: [{ ...valid.devices[0], outboundTrafficHistory: [{ observedAt, vpnBytes: '1' }] }] },
|
||||
{ ...supported, tags: [{ id: 'bad', name: 'Дом' }] },
|
||||
{ ...supported, tags: [{ ...supported.tags[0], name: ' '.repeat(2) }] },
|
||||
{ ...supported, devices: [{ ...valid.devices[0] }] },
|
||||
{ ...supported, devices: [{ ...supported.devices[0], tagIds: ['tag_ffffffffffffffff'] }] },
|
||||
{ ...valid, traffic: { ...valid.traffic, totalBytes: -4 } },
|
||||
{ ...valid, traffic: { ...valid.traffic, observedAt: 'not-a-date' } },
|
||||
{ ...valid, source: { ...valid.source, kind: 'arp' } },
|
||||
|
||||
Reference in New Issue
Block a user