mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-16 08:25:14 +02:00
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.
This commit is contained in:
parent
6c815ef529
commit
fde9f9862d
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue