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,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,8 +16,8 @@ test('gateway deploy updates control without recreating dataplane', () => {
|
||||
assert.match(compose, /DATAPLANE_SOCKET: \/run\/vpn-proxy\/dataplane\.sock/);
|
||||
assert.match(deploy, /up -d --no-deps --wait[^\n]+vpn-proxy-control/);
|
||||
assert.match(workflow, /UPDATE_DATAPLANE="\$\{UPDATE_DATAPLANE\}"/);
|
||||
assert.match(workflow, /src\/server\/\(config\|dataplane\|gatewayRouting\|singboxRuntime\|version\)/);
|
||||
assert.match(workflow, /src\/server\/\(adapters\/neighbors\|services\/\(deviceTrafficService\|devicePolicyService\)\)/);
|
||||
assert.match(workflow, /src\/server\/\(config\|dataplane\|gatewayRouting\|singbox\|singboxRuntime\|version\)/);
|
||||
assert.match(workflow, /src\/server\/\(adapters\/neighbors\|services\/\(connectivityDiagnosticsService\|deviceTrafficService\|devicePolicyService\)\)/);
|
||||
assert.match(workflow, /src\/shared\/errors/);
|
||||
assert.doesNotMatch(workflow, /dataplaneClient/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user