feat(fleet): add shared WireGuard profiles and bounded rover transport
Add portable shared WireGuard profiles while retaining Tailscale and Worker boundaries. Bound rover command/telemetry delivery, recovery and diagnostic capture across Core and Node.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {build} from 'esbuild';
|
||||
const compiled=await build({entryPoints:[new URL('../src/core/fleet/roverDevEvents.ts',import.meta.url).pathname],bundle:true,write:false,platform:'node',format:'esm'});
|
||||
const {connectRoverEvidence,roverDevEvent}=await import('data:text/javascript;base64,'+Buffer.from(compiled.outputFiles[0].contents).toString('base64'));
|
||||
test('browser evidence is opt-in, separate, and disabled again at session end',async()=>{
|
||||
const original=globalThis.fetch,calls=[];globalThis.fetch=async(_url,init)=>{calls.push(JSON.parse(init.body));return {ok:true};};
|
||||
const connection=connectRoverEvidence('/rover');
|
||||
try{
|
||||
roverDevEvent('/rover','demand',{left:1});await connection.flush();assert.equal(calls.length,0);
|
||||
connection.set('a'.repeat(32));roverDevEvent('/rover','demand',{left:1,right:-1});await connection.flush();
|
||||
assert.equal(calls.length,1);assert.equal(calls[0].events[0].right,-1);
|
||||
connection.set(null);roverDevEvent('/rover','demand',{left:1});await connection.flush();assert.equal(calls.length,1);
|
||||
}finally{connection.close();globalThis.fetch=original;}
|
||||
});
|
||||
Reference in New Issue
Block a user