Support custom BPQ Telnet prompts and banners, fix installer arguments

This commit is contained in:
alberto committed 2026-10-17 14:14:16 +02:00
1 parent 33d2cc4fbd
commit 2b00b1cbbd
14 files changed
+168 -44

No files matched your search

+5 -1
View File
@@ -71,7 +71,7 @@ test('CLI parses explicit options and rejects typos or missing values',()=>{
test('PowerShell installer CheckOnly supports paths with spaces and skips startup, task and firewall', {skip:process.platform!=='win32'},async t=>{
const f=await fixture(t);const fake=http.createServer((req,res)=>res.end('<a href=/Node/Ports.html>BPQ Ports</a>'));await new Promise(r=>fake.listen(0,'127.0.0.1',r));t.after(()=>new Promise(r=>fake.close(r)));await fs.writeFile(path.join(f.root,'BPQ32.cfg'),cfg().replace('8088',String(fake.address().port)));
const env={...process.env,BPQ_CONSOLE_CONFIG:f.options.configPath};delete env.BPQ_ROOT;delete env.BPQ_CONSOLE_PORT;
const result=await run('powershell.exe',['-NoProfile','-NonInteractive','-ExecutionPolicy','RemoteSigned','-File',path.resolve('Install.ps1'),'-NodeExe',process.execPath,'-BpqRoot',f.root,'-CheckOnly','-AutoStart','-EnableLAN','-Restart'],{env,windowsHide:true,timeout:20000});assert.match(result.stdout,/N9DEMO-7/);assert.ok(!result.stdout.includes('fixture-secret'));await assert.rejects(fs.stat(f.options.configPath),{code:'ENOENT'});
const result=await run('powershell.exe',['-NoProfile','-NonInteractive','-ExecutionPolicy','RemoteSigned','-File',path.resolve('Install.ps1'),'-NodeExe',process.execPath,'-BpqRoot',f.root,'-CheckOnly','-AutoStart','-EnableLAN','-Restart','-RadioPort','3','-SysopUser','operator','-Language','en','-ForwardPeer','N1PEER','-CmsPeer','CMS2'],{env,windowsHide:true,timeout:20000});assert.match(result.stdout,/N9DEMO-7/);const report=JSON.parse(result.stdout);assert.equal(report.selectedRadio,3);assert.equal(report.sysopUser,'operator');assert.ok(!result.stdout.includes('fixture-secret'));await assert.rejects(fs.stat(f.options.configPath),{code:'ENOENT'});
});
const freePort=async()=>{const s=net.createServer();await new Promise(r=>s.listen(0,'127.0.0.1',r));const p=s.address().port;await new Promise(r=>s.close(r));return p;};
test('PowerShell startup confirms readiness, handles duplicate starts, restart and failed startup', {skip:process.platform!=='win32'},async t=>{
@@ -82,3 +82,7 @@ test('PowerShell startup confirms readiness, handles duplicate starts, restart a
port=await freePort();await fs.writeFile(configFile,JSON.stringify({port,nodeExe:process.execPath}));await assert.rejects(start([]));assert.match((await start(['-Restart'])).stdout,/avviato/);pid=(await(await fetch('http://127.0.0.1:'+port+'/health')).json()).pid;
await fs.writeFile(path.join(f.dir,'server.mjs'),"throw new Error('fixture startup failure');");await assert.rejects(start(['-Restart']));pid=null;assert.match(await fs.readFile(path.join(f.dir,'server-error.log'),'utf8'),/fixture startup failure/);
});
test('installer language defaults can be selected, preserved and validated',async t=>{
const f=await fixture(t);const plan=await prepareInstall({...f.options,language:'en'},{probe});assert.equal(plan.config.language,'en');await saveInstall(plan);assert.equal((await prepareInstall(f.options,{probe})).config.language,'en');assert.equal((await prepareInstall({...f.options,language:'it'},{probe})).config.language,'it');await assert.rejects(prepareInstall({...f.options,language:'fr'},{probe}),/language/);assert.equal(parseArgs(['--language','en']).language,'en');
});