Handle connectivity diagnostics failures
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user