row 233: the lock test kills its flock holder's process group (N1, sage-1707)
stack-upgrade.test.mjs:312 spawned `flock LOCK sleep 60` and SIGKILLed only the flock, so its `sleep 60` child outlived the test. Spawn it detached and kill the group with process.kill(-pid), as row 232's T20 does (stack-release.test.mjs:370). Test only.
This commit is contained in:
@@ -309,8 +309,8 @@ test('row 233: sequence 8: a migration that writes and fails: the driver reverts
|
||||
test('row 233: a second run while the lock is held refuses upgrade-running with one log line and no call',async(t)=>{
|
||||
const e=await useed(t);
|
||||
mkdirSync(e.run,{recursive:true});
|
||||
const holder=spawn('flock',[e.lockf,'sleep','60'],{stdio:'ignore'});
|
||||
t.after(()=>holder.kill('SIGKILL'));
|
||||
const holder=spawn('flock',[e.lockf,'sleep','60'],{detached:true,stdio:'ignore'});
|
||||
t.after(()=>{try{process.kill(-holder.pid,'SIGKILL')}catch{}});
|
||||
for(let i=0;i<100&&execFileSync('bash',['-c','flock -n "$1" true && echo free || echo held','_',e.lockf],{encoding:'utf8'}).trim()==='free';i++)await new Promise((r)=>setTimeout(r,50));
|
||||
const r=await upgrade(e,C1);assert.equal(r.code,3,r.all);
|
||||
assert.equal(r.err,`stack-upgrade: upgrade-running: another stack-upgrade.sh run holds ${e.lockf} (nothing was stopped)\n`);
|
||||
|
||||
Reference in New Issue
Block a user