Fix CI smoke checks

This commit is contained in:
Andrey Avtomonov 2026-05-14 01:31:06 +02:00
parent 2fd2bfde98
commit 3ee48e0752
8 changed files with 34 additions and 30 deletions

View file

@ -911,7 +911,7 @@ describe('runContextBuild', () => {
warehouse: { driver: 'postgres', context: { depth: 'deep' } },
},
llm: {
provider: { backend: 'gateway', gateway: { api_key: 'env:KTX_GATEWAY_API_KEY' } },
provider: { backend: 'gateway', gateway: { api_key: 'env:KTX_GATEWAY_API_KEY' } }, // pragma: allowlist secret
models: { default: 'gpt-test' },
},
scan: {

View file

@ -330,8 +330,8 @@ describe('runKtxDoctor', () => {
});
it('includes Postgres query-history readiness in project doctor output', async () => {
process.env.ANTHROPIC_API_KEY = 'test-key';
process.env.OPENAI_API_KEY = 'test-key';
process.env.ANTHROPIC_API_KEY = 'test-key'; // pragma: allowlist secret
process.env.OPENAI_API_KEY = 'test-key'; // pragma: allowlist secret
await writeFile(
join(tempDir, 'ktx.yaml'),
[

View file

@ -110,7 +110,7 @@ describe('standalone local warehouse example', () => {
'fake',
]);
expect(ingest).toMatchObject({ code: 1, stdout: '' });
expect(ingest.stderr).toContain("unknown command 'run'");
expect(ingest.stderr).toContain("unknown option '--connection-id'");
}, 30_000);
});

View file

@ -26,12 +26,13 @@ function isExecFailure(error: unknown): error is ExecFailure {
return error instanceof Error && ('stdout' in error || 'stderr' in error || 'code' in error);
}
async function runBuiltCli(args: string[], options: { env?: NodeJS.ProcessEnv } = {}): Promise<CliResult> {
async function runBuiltCli(args: string[], options: { cwd?: string; env?: NodeJS.ProcessEnv } = {}): Promise<CliResult> {
try {
const result = await execFileAsync(process.execPath, [CLI_BIN, ...args], {
...(options.cwd ? { cwd: options.cwd } : {}),
encoding: 'utf8',
timeout: 20_000,
...(options.env ? { env: options.env } : {}),
env: options.env ?? process.env,
});
return {
code: 0,
@ -166,11 +167,13 @@ describe('standalone built ktx CLI smoke', () => {
});
it('runs doctor setup through the built binary', async () => {
const result = await runBuiltCli(['status', '--no-input']);
const env = { ...process.env };
delete env.KTX_PROJECT_DIR;
const result = await runBuiltCli(['status', '--no-input'], { cwd: tempDir, env });
expect(result.stdout).toMatch(/KTX (setup doctor|project doctor|status)/);
if (result.stdout.includes('No project here yet.')) {
expect(result.stdout).toContain('Before you can run ktx setup');
expect(result.stdout).toContain('ktx setup');
} else {
expect(result.stdout).toContain('Node 22+');
expect(result.stdout).toContain('Workspace-local CLI');