From 62eaa98a6e19aff225cb3a07371920446a7f9e1b Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov Date: Thu, 14 May 2026 18:02:46 +0200 Subject: [PATCH] test(cli): align metabase fixtures with required api_url field The driver-discriminated union added in this branch now requires api_url for metabase connections and a known driver for warehouses. Update slow CLI test fixtures and assertions so they exercise the new schema: - ingest.test-utils.ts: add api_url to the prod-metabase fixture. - setup.test.ts: switch metabase fixture from 'url' to 'api_url'. - local-scan-connectors.test.ts: invalid-driver/missing-driver tests now expect the schema error from loadKtxProject (parse-time rejection). --- packages/cli/src/ingest.test-utils.ts | 1 + packages/cli/src/local-scan-connectors.test.ts | 14 ++++++-------- packages/cli/src/setup.test.ts | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/ingest.test-utils.ts b/packages/cli/src/ingest.test-utils.ts index 048e7411..41affbb9 100644 --- a/packages/cli/src/ingest.test-utils.ts +++ b/packages/cli/src/ingest.test-utils.ts @@ -109,6 +109,7 @@ export async function writeWarehouseConfig(projectDir: string): Promise { 'connections:', ' prod-metabase:', ' driver: metabase', + ' api_url: https://metabase.example.test', ' warehouse_a:', ' driver: postgres', 'ingest:', diff --git a/packages/cli/src/local-scan-connectors.test.ts b/packages/cli/src/local-scan-connectors.test.ts index a0f9e714..b9672bfa 100644 --- a/packages/cli/src/local-scan-connectors.test.ts +++ b/packages/cli/src/local-scan-connectors.test.ts @@ -92,7 +92,7 @@ describe('createKtxCliScanConnector', () => { expect(bigQueryMock.constructorInputs[0]).not.toHaveProperty('maxBytesBilled'); }); - it('throws for structural daemon-only fallback configs', async () => { + it('rejects daemon-only fallback driver configs at config parse time', async () => { await initKtxProject({ projectDir: tempDir }); await writeFile( join(tempDir, 'ktx.yaml'), @@ -105,14 +105,13 @@ describe('createKtxCliScanConnector', () => { ].join('\n'), 'utf-8', ); - const project = await loadKtxProject({ projectDir: tempDir }); - await expect(createKtxCliScanConnector(project, 'warehouse')).rejects.toThrow( - 'Connection "warehouse" uses driver "duckdb", which has no native standalone KTX scan connector', + await expect(loadKtxProject({ projectDir: tempDir })).rejects.toThrow( + /connections\.warehouse\.driver:.*Invalid discriminator value/, ); }); - it('throws a clear error when the connection block has no driver field', async () => { + it('rejects connection blocks with no driver field at config parse time', async () => { await initKtxProject({ projectDir: tempDir }); await writeFile( join(tempDir, 'ktx.yaml'), @@ -125,10 +124,9 @@ describe('createKtxCliScanConnector', () => { ].join('\n'), 'utf-8', ); - const project = await loadKtxProject({ projectDir: tempDir }); - await expect(createKtxCliScanConnector(project, 'warehouse')).rejects.toThrow( - 'Connection "warehouse" has no `driver` field in ktx.yaml', + await expect(loadKtxProject({ projectDir: tempDir })).rejects.toThrow( + /connections\.warehouse\.driver:.*Invalid discriminator value/, ); }); }); diff --git a/packages/cli/src/setup.test.ts b/packages/cli/src/setup.test.ts index 84b9e1a2..ff1261c3 100644 --- a/packages/cli/src/setup.test.ts +++ b/packages/cli/src/setup.test.ts @@ -311,7 +311,7 @@ describe('setup status', () => { ' url: env:DATABASE_URL', ' metabase:', ' driver: metabase', - ' url: env:METABASE_URL', + ' api_url: https://metabase.example.test', ' api_key_ref: env:METABASE_API_KEY', ' warehouse_connection_id: warehouse', 'llm:',