20 lines
2.0 KiB
Plaintext
20 lines
2.0 KiB
Plaintext
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { spawn } from 'node:child_process';
|
|
import { createHash } from 'node:crypto';
|
|
import { projectEnvironment } from '../../src/core/process-environment.mjs';
|
|
const root=path.resolve('.qa/reliability-1.25.2'),deadline=Date.now()+35*60000;
|
|
const archive=path.join(root,'release-final/receipts/archives.json');
|
|
while(!fs.existsSync(archive)){assert.ok(Date.now()<deadline,'Waited too long for package/archive completion.');await new Promise(resolve=>setTimeout(resolve,3000));}
|
|
assert.equal(JSON.parse(fs.readFileSync(archive)).success,true,'Do not add test load during unfinished packaging.');
|
|
const freeze=JSON.parse(fs.readFileSync(path.join(root,'release-final/freeze.json')));
|
|
for(const row of freeze.inputs)assert.equal(createHash('sha256').update(fs.readFileSync(row.path)).digest('hex'),row.sha256);
|
|
const output=path.join(root,'api-restart-recheck.tap'),log=path.join(root,'api-restart-recheck.log');
|
|
const fd=fs.openSync(log,'wx'),startedAt=new Date().toISOString();
|
|
const code=await new Promise((resolve,reject)=>{const child=spawn(process.execPath,['--test','--test-name-pattern=a real bundle restart preserves proposals','--test-reporter=spec','--test-reporter-destination=stdout','--test-reporter=tap','--test-reporter-destination='+output,'tests/api.test.mjs'],{windowsHide:true,env:projectEnvironment(),stdio:['ignore',fd,fd]});child.once('error',reject);child.once('close',resolve);});
|
|
fs.closeSync(fd);
|
|
const receipt={success:code===0,code,startedAt,finishedAt:new Date().toISOString(),sourceCommit:freeze.sourceCommit,scope:'One exact unchanged API restart/approval test, original QA deadlines; no real model/formal state.',log,output,realModelRequests:0};
|
|
fs.writeFileSync(path.join(root,'api-restart-recheck.json'),JSON.stringify(receipt,null,2)+'\n',{flag:'wx'});
|
|
console.log(JSON.stringify(receipt));assert.equal(code,0,'Inspect original TAP and exact assertion before continuing.');
|