test: add comprehensive Curio installation and runtime fixtures

This commit is contained in:
2026-09-09 17:14:52 +08:00
parent 0d38ef2959
commit 775d891288
38 changed files with 3609 additions and 4 deletions
+33
View File
@@ -0,0 +1,33 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { spawnSync } from 'node:child_process';
export const root = fileURLToPath(new URL('../', import.meta.url));
export const suite = [
{ directory: 'test-host', mode: 'host' },
{ directory: 'test-isolation', mode: 'host' },
{ directory: 'test-self', mode: 'backend', service: '@self' },
{ directory: 'test-provider' },
{ directory: 'test-consumer', mode: 'backend', service: 'dev.trove.qa.provider.probe' },
{ directory: 'test-optional', mode: 'dependency', service: 'dev.trove.qa.absent.probe', expectedError: 'service.not_found' },
{ directory: 'test-required', mode: 'dependency', service: 'dev.trove.qa.absent.probe', expectedError: 'service.not_found', fault: true },
{ directory: 'test-incompatible', mode: 'dependency', service: 'dev.trove.qa.provider.probe', expectedError: 'service.version_mismatch', fault: true },
{ directory: 'test-autostart' },
{ directory: 'test-crash', mode: 'backend', service: '@self', fault: true },
{ directory: 'test-start-timeout', mode: 'fault', service: '@self', fault: true },
{ directory: 'test-bad-handshake', mode: 'fault', service: '@self', fault: true },
{ directory: 'test-stubborn', mode: 'backend', service: '@self', fault: true },
{ directory: 'test-upgrade-v1', mode: 'upgrade' },
{ directory: 'test-upgrade-v2', mode: 'upgrade' },
];
export function run(command, args, options = {}) {
const result = spawnSync(command, args, { cwd: root, stdio: 'inherit', ...options });
if (result.error) throw result.error;
if (result.status !== 0) throw new Error(`${command} exited with ${result.status ?? result.signal}`);
return result;
}
// Tooling accepts the installed CLI or an explicit build; plugin packages are self-contained.
export const troveBin = process.env.TROVE_BIN || 'trove';
export const output = path.join(root, 'dist');