Add per-device VPN and direct routing policies
Build and Deploy Gateway / build-and-push (push) Successful in 10s
Build and Deploy Gateway / deploy (push) Successful in 16s

This commit is contained in:
2026-08-07 16:18:31 +03:00
parent 307ad02cd7
commit 560c243047
20 changed files with 1090 additions and 114 deletions
+8 -3
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) => {
requests.push(`${method} ${pathname} ${socketPath}`);
const send = async (socketPath, pathname, method, body) => {
requests.push({ method, pathname, socketPath, body });
return {
running: pathname !== '/stop',
startedAt: 'now',
@@ -24,15 +24,20 @@ test('control uses the dataplane socket protocol', async () => {
assert.equal(devices.running, true);
const traffic = await client.observeTraffic();
assert.equal(traffic.running, true);
await client.observeDevicePolicy();
await client.applyDevicePolicies([{ id: 'dev_0011223344556677' }]);
assert.equal(client.running, true);
await client.restart();
assert.equal((await client.stop()).running, false);
assert.deepEqual(requests, [
assert.deepEqual(requests.map(({ method, pathname, socketPath }) => `${method} ${pathname} ${socketPath}`), [
'GET /status /run/dataplane.sock',
'POST /apply /run/dataplane.sock',
'GET /devices /run/dataplane.sock',
'GET /device-traffic /run/dataplane.sock',
'GET /device-policy /run/dataplane.sock',
'PUT /device-policy /run/dataplane.sock',
'POST /restart /run/dataplane.sock',
'POST /stop /run/dataplane.sock',
]);
assert.deepEqual(requests[5].body, { devices: [{ id: 'dev_0011223344556677' }] });
});