From fde9f9862d6c51a894acce8ed14b7a96aa6b8b7e Mon Sep 17 00:00:00 2001 From: Andrey Avtomonov Date: Mon, 15 Jun 2026 17:23:59 +0200 Subject: [PATCH] test(cli): persist warehouse connection in sl query tests (#303) #301 strengthened resolveLocalConnectionId to reject connections absent from ktx.yaml, but three sl query tests configured the warehouse connection only in memory while runKtxSl reloads the project from disk, so they returned exit code 1 once the check landed on main. Persist the connection to ktx.yaml so it survives the reload and the tests exercise the real on-disk load path. --- packages/cli/test/sl.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/cli/test/sl.test.ts b/packages/cli/test/sl.test.ts index 489ea950..ca37747e 100644 --- a/packages/cli/test/sl.test.ts +++ b/packages/cli/test/sl.test.ts @@ -618,6 +618,15 @@ joins: [] vi.stubEnv('CI', ''); const projectDir = join(tempDir, 'project'); await seedSlSource({ projectDir }); + const config = parseKtxProjectConfig(await readFile(join(projectDir, 'ktx.yaml'), 'utf-8')); + await writeFile( + join(projectDir, 'ktx.yaml'), + serializeKtxProjectConfig({ + ...config, + connections: { ...config.connections, warehouse: { driver: 'postgres' } }, + }), + 'utf-8', + ); const io = makeIo({ isTTY: true }); const createSemanticLayerCompute = vi.fn(() => ({ query: vi.fn(async () => ({ @@ -654,6 +663,7 @@ joins: [] const projectDir = join(tempDir, 'project'); const project = await initKtxProject({ projectDir }); project.config.connections.warehouse = { driver: 'postgres' }; + await writeFile(join(projectDir, 'ktx.yaml'), serializeKtxProjectConfig(project.config), 'utf-8'); await project.fileStore.writeFile( 'semantic-layer/warehouse/orders.yaml', `name: orders @@ -721,6 +731,7 @@ joins: [] const projectDir = join(tempDir, 'project'); const project = await initKtxProject({ projectDir }); project.config.connections.warehouse = { driver: 'postgres' }; + await writeFile(join(projectDir, 'ktx.yaml'), serializeKtxProjectConfig(project.config), 'utf-8'); await project.fileStore.writeFile( 'semantic-layer/warehouse/orders.yaml', `name: orders