test: batch exhaustive source verification and preserve original timeout evidence
This commit is contained in:
@@ -181,12 +181,24 @@ try {
|
||||
// Only this file opens the fixed inspector port. Run it separately so another
|
||||
// test's child host can never compete for that port during the full suite.
|
||||
const testFiles = files(path.join(sourceRoot, 'tests')).filter(file => !file.includes(path.sep) && file.endsWith('.test.mjs'));
|
||||
const testGroups = [testFiles.filter(file => file !== 'upgrade.test.mjs'), ['upgrade.test.mjs']];
|
||||
const ordinaryTests = testFiles.filter(file => file !== 'upgrade.test.mjs');
|
||||
const testGroups = [];
|
||||
// Keep the per-process deadline, while letting the growing suite complete in
|
||||
// bounded batches. A slow worker recovery file must not consume the deadline
|
||||
// of every preceding, unrelated file. Every discovered file runs exactly once.
|
||||
for (let offset = 0; offset < ordinaryTests.length; offset += 8) testGroups.push(ordinaryTests.slice(offset, offset + 8));
|
||||
testGroups.push(['upgrade.test.mjs']);
|
||||
assert.deepEqual(testGroups.flat().slice().sort(), testFiles.slice().sort());
|
||||
assert.equal(new Set(testGroups.flat()).size, testFiles.length);
|
||||
const testPlan = testGroups.map((group, index) => ({ index, files: group, concurrency: index === testGroups.length - 1 ? 1 : 2, timeoutMs: 30 * 60 * 1000 }));
|
||||
fs.writeFileSync(path.join(directory, 'test-plan.json'), JSON.stringify(testPlan, null, 2));
|
||||
const stats = Object.fromEntries(['tests', 'pass', 'fail', 'cancelled', 'skipped', 'todo'].map(key => [key, 0]));
|
||||
for (const [index, group] of testGroups.entries()) {
|
||||
assert.ok(group.length > 0);
|
||||
stage = index === 0 ? 'full tests without fixed inspector' : 'exclusive retained upgrade tests';
|
||||
const output = await run(['--test', '--test-concurrency=' + (index === 0 ? 2 : 1), '--test-reporter=tap', ...group.map(file => path.join('tests', file))], index === 0 ? 'tests.tap' : 'upgrade-tests.tap');
|
||||
const exclusiveUpgrade = index === testGroups.length - 1;
|
||||
stage = exclusiveUpgrade ? 'exclusive retained upgrade tests' : 'full source tests batch ' + (index + 1) + '/' + (testGroups.length - 1);
|
||||
const logName = exclusiveUpgrade ? 'upgrade-tests.tap' : 'tests-' + String(index + 1).padStart(2, '0') + '.tap';
|
||||
const output = await run(['--test', '--test-concurrency=' + testPlan[index].concurrency, '--test-reporter=tap', ...group.map(file => path.join('tests', file))], logName);
|
||||
const groupStats = Object.fromEntries([...output.matchAll(/^# (tests|pass|fail|cancelled|skipped|todo) (\d+)\s*$/gm)].map(match => [match[1], Number(match[2])]));
|
||||
assert.ok(groupStats.tests > 0); assert.equal(groupStats.pass, groupStats.tests);
|
||||
for (const key of Object.keys(stats)) { assert.ok(Number.isInteger(groupStats[key])); stats[key] += groupStats[key]; }
|
||||
@@ -263,7 +275,7 @@ try {
|
||||
}
|
||||
assert.deepEqual(snapshot(), inputs, 'Source package inputs changed during validation.');
|
||||
const result = { success: true, version: evidence.version, testedAt: new Date().toISOString(), sourceRoot, directory, nodeVersion: process.version, python, offlineInstall: true,
|
||||
inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, buildFiles: Object.entries(expected).map(([path, sha256]) => ({ path: path.replaceAll('\\', '/'), sha256 })), tests: stats, actualEnvironment, actualEnvironmentEngineering, actualTaskControl, actualRea, actualEngine, actualBrowser, actualControlled, actualDesktop, actualCompanion, actualProtocols, actualProtocolEngineering, actualVision, actualVisionEngineering, actualProjectCache, actualCacheEngineering, actualEvaluations, actualEvaluationEngineering, credentialsHandling: 'Only build/runtime environment paths are inherited; no configured model credentials are used. The controlled-engine stage supplies a declared owned local response fixture.' };
|
||||
inputs, inputFiles: inputs.length, logs, buildMatchedFiles: Object.keys(expected).length, buildFiles: Object.entries(expected).map(([path, sha256]) => ({ path: path.replaceAll('\\', '/'), sha256 })), tests: stats, testPlan, actualEnvironment, actualEnvironmentEngineering, actualTaskControl, actualRea, actualEngine, actualBrowser, actualControlled, actualDesktop, actualCompanion, actualProtocols, actualProtocolEngineering, actualVision, actualVisionEngineering, actualProjectCache, actualCacheEngineering, actualEvaluations, actualEvaluationEngineering, credentialsHandling: 'Only build/runtime environment paths are inherited; no configured model credentials are used. The controlled-engine stage supplies a declared owned local response fixture.' };
|
||||
save(result); console.log(JSON.stringify({ success: true, version: result.version, sourceRoot, directory, tests: stats, nodeVersion: process.version, python, inputFiles: inputs.length, buildMatchedFiles: result.buildMatchedFiles, rea: !!actualRea?.success, engine: !!actualEngine?.success, browser: !!actualBrowser?.success, controlled: !!actualControlled?.success }));
|
||||
} catch (error) {
|
||||
save({ success: false, version: evidence.version, testedAt: new Date().toISOString(), stage, error: error.message, sourceRoot, directory, nodeVersion: process.version, python, inputs, logs });
|
||||
|
||||
Reference in New Issue
Block a user