Handle connectivity diagnostics failures
Build and Deploy Gateway / build-and-push (push) Successful in 13s
Build and Deploy Gateway / deploy (push) Successful in 13s

This commit is contained in:
2026-08-07 20:58:18 +03:00
parent 12375006d3
commit 0c376c72aa
6 changed files with 30 additions and 11 deletions
+14 -2
View File
@@ -4,8 +4,8 @@ import { createDataplaneClient } from '../../src/server/dataplaneClient.js';
test('control uses the dataplane socket protocol', async () => {
const requests = [];
const send = async (socketPath, pathname, method, body) => {
requests.push({ method, pathname, socketPath, body });
const send = async (socketPath, pathname, method, body, timeoutMs) => {
requests.push({ method, pathname, socketPath, body, timeoutMs });
return {
running: pathname !== '/stop',
startedAt: 'now',
@@ -42,4 +42,16 @@ test('control uses the dataplane socket protocol', async () => {
'POST /stop /run/dataplane.sock',
]);
assert.deepEqual(requests[5].body, { devices: [{ id: 'dev_0011223344556677' }] });
assert.equal(requests[6].timeoutMs, 15_000);
});
test('connectivity diagnostics expose a retryable domain error', async () => {
const client = createDataplaneClient('/run/dataplane.sock', async () => {
throw new Error('Dataplane не ответил');
});
await assert.rejects(client.runConnectivityDiagnostics(), {
code: 'DIAGNOSTICS_FAILED',
retryable: true,
});
});