mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-13 11:57:19 +01:00
* test: docsync fault replays and the runShadow deadline test fit loaded remote VMs (GST-1103) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: docsync-report-interface child cases get the same derived limits (GST-1103) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: GST-1103 changelog fragment wording Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
33 lines
1.7 KiB
TypeScript
33 lines
1.7 KiB
TypeScript
// Split from test/docsync-fault-interface.test.ts (GSTA-151): the legacy-control callback replays.
|
|
import { expect, test } from 'bun:test';
|
|
import * as fs from 'node:fs';
|
|
import * as os from 'node:os';
|
|
import * as path from 'node:path';
|
|
import { callbackBudgetMs, docsFaultCallbackScript } from './helpers/docsync-fault-callbacks';
|
|
|
|
const CALLBACK_SPLITS = [
|
|
['legacy controls', '^ship-docsync-failure rejects ', 12],
|
|
] as const;
|
|
|
|
for (const [split, pattern, count] of CALLBACK_SPLITS) test(`registered fault callbacks execute actual transport and hook commands, consume results, and reject controls without model calls (${split})`, () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'docs-fault-callback-'));
|
|
const root = path.resolve(import.meta.dir, '..');
|
|
try {
|
|
const script = path.join(dir, 'callbacks.test.ts');
|
|
fs.writeFileSync(script, docsFaultCallbackScript(root));
|
|
const home = path.join(dir, 'home');
|
|
fs.mkdirSync(home);
|
|
const result = Bun.spawnSync([process.execPath, 'test', script, '--test-name-pattern', pattern], {
|
|
env: { ...process.env, EVALS: '', EVALS_TIER: '', EVALS_ALL: '', EVALS_RUN_ID: 'free-docsync-faults',
|
|
HOME: home, USERPROFILE: home,
|
|
GSTACK_EVAL_DIR: path.join(dir, 'evidence'), GSTACK_HOME: path.join(dir, 'state') },
|
|
stdout: 'pipe', stderr: 'pipe', timeout: callbackBudgetMs(count),
|
|
});
|
|
const output = result.stdout.toString() + result.stderr.toString();
|
|
expect(result.exitCode, output).toBe(0);
|
|
expect(output).toContain(`${count} pass`);
|
|
expect(output).toContain(`${36 - count} filtered out`);
|
|
expect(output).toContain('0 fail');
|
|
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
}, callbackBudgetMs(count) + 10_000);
|