mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-16 08:25:14 +02:00
refactor: remove legacy compatibility shims
This commit is contained in:
parent
394a985d2a
commit
4bd95e425d
17 changed files with 61 additions and 361 deletions
|
|
@ -2125,7 +2125,6 @@ describe('setup databases step', () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(config.connections.snowflake.historicSql).toBeUndefined();
|
||||
expect(configText).not.toContain('live-database');
|
||||
expect(configText).not.toContain('historic-sql');
|
||||
expect(configText).not.toMatch(/^\s+adapters:/m);
|
||||
|
|
@ -2223,7 +2222,6 @@ describe('setup databases step', () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(config.connections.warehouse.historicSql).toBeUndefined();
|
||||
const warehouseContext =
|
||||
config.connections.warehouse.context &&
|
||||
typeof config.connections.warehouse.context === 'object' &&
|
||||
|
|
@ -2368,7 +2366,6 @@ describe('setup databases step', () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(config.connections.analytics.historicSql).toBeUndefined();
|
||||
expect(configText).not.toContain('live-database');
|
||||
expect(configText).not.toContain('historic-sql');
|
||||
expect(configText).not.toMatch(/^\s+adapters:/m);
|
||||
|
|
@ -2420,80 +2417,6 @@ describe('setup databases step', () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(config.connections.warehouse.historicSql).toBeUndefined();
|
||||
});
|
||||
|
||||
it('migrates legacy historicSql to context.queryHistory during database setup', async () => {
|
||||
await writeFile(
|
||||
join(tempDir, 'ktx.yaml'),
|
||||
[
|
||||
'connections:',
|
||||
' warehouse:',
|
||||
' driver: postgres',
|
||||
' readonly: true',
|
||||
' historicSql:',
|
||||
' enabled: true',
|
||||
' dialect: postgres',
|
||||
' windowDays: 45',
|
||||
' minExecutions: 9',
|
||||
' concurrency: 3',
|
||||
' staleArchiveAfterDays: 120',
|
||||
' filters:',
|
||||
' dropTrivialProbes: true',
|
||||
' serviceAccounts:',
|
||||
' mode: exclude',
|
||||
' patterns:',
|
||||
" - '^svc_'",
|
||||
' orchestrators:',
|
||||
' mode: exclude',
|
||||
' patterns:',
|
||||
' - airflow',
|
||||
' dropFailedBelow: 2',
|
||||
' redactionPatterns:',
|
||||
" - '(?i)secret'",
|
||||
'',
|
||||
].join('\n'),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
const io = makeIo();
|
||||
|
||||
await expect(
|
||||
runKtxSetupDatabasesStep(
|
||||
{
|
||||
projectDir: tempDir,
|
||||
inputMode: 'disabled',
|
||||
databaseConnectionIds: ['warehouse'],
|
||||
databaseSchemas: [],
|
||||
skipDatabases: false,
|
||||
},
|
||||
io.io,
|
||||
{
|
||||
testConnection: vi.fn(async () => 0),
|
||||
scanConnection: vi.fn(async () => 0),
|
||||
historicSqlProbe: vi.fn(async () => ({ ok: true, lines: [] })),
|
||||
},
|
||||
),
|
||||
).resolves.toMatchObject({ status: 'ready' });
|
||||
|
||||
const config = parseKtxProjectConfig(await readFile(join(tempDir, 'ktx.yaml'), 'utf-8'));
|
||||
expect(config.connections.warehouse.historicSql).toBeUndefined();
|
||||
expect(config.connections.warehouse.context).toMatchObject({
|
||||
queryHistory: {
|
||||
enabled: true,
|
||||
windowDays: 45,
|
||||
minExecutions: 9,
|
||||
concurrency: 3,
|
||||
staleArchiveAfterDays: 120,
|
||||
filters: {
|
||||
dropTrivialProbes: true,
|
||||
serviceAccounts: { mode: 'exclude', patterns: ['^svc_'] },
|
||||
orchestrators: { mode: 'exclude', patterns: ['airflow'] },
|
||||
dropFailedBelow: 2,
|
||||
},
|
||||
redactionPatterns: ['(?i)secret'],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('prints a non-blocking Postgres query history probe failure after connection test succeeds', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue