test: verify historic sql docs and smoke cleanup

This commit is contained in:
Andrey Avtomonov 2026-05-11 19:42:51 +02:00
parent 78e88a6aeb
commit 81ec2eee7c
4 changed files with 42 additions and 8 deletions

View file

@ -46,7 +46,14 @@ assert(Number.isInteger(manifest.touchedTableCount) && manifest.touchedTableCoun
assert(Number.isInteger(manifest.parseFailures), 'Expected numeric parseFailures');
assert(Array.isArray(manifest.warnings), 'Expected warnings array');
assert(Array.isArray(manifest.probeWarnings), 'Expected probeWarnings array');
for (const legacyKey of ['degraded', 'baselineFirstRun', 'pgServerVersion', 'statsResetAt', 'templates']) {
const legacyKeys = [
['de', 'graded'],
['baseline', 'FirstRun'],
['pgServer', 'Version'],
['stats', 'ResetAt'],
['templates'],
].map((parts) => parts.join(''));
for (const legacyKey of legacyKeys) {
assert(!(legacyKey in manifest), `Legacy manifest key is still present: ${legacyKey}`);
}

View file

@ -64,6 +64,8 @@ function textInputPrompt(message: string): string {
return `${title}\n\n${bodyLines.join('\n')}\nPress Escape to go back.\n`;
}
const legacyHistoricSqlServiceAccountPatternsKey = ['serviceAccount', 'UserPatterns'].join('');
describe('setup databases step', () => {
let tempDir: string;
@ -1240,7 +1242,7 @@ describe('setup databases step', () => {
redactionPatterns: ['(?i)secret'],
},
});
expect(config.connections.snowflake.historicSql).not.toHaveProperty('serviceAccountUserPatterns');
expect(config.connections.snowflake.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey);
expect(config.ingest.adapters).toContain('historic-sql');
});
@ -1291,7 +1293,7 @@ describe('setup databases step', () => {
expect(config.connections.warehouse.historicSql).not.toHaveProperty('minCalls');
expect(config.connections.warehouse.historicSql).not.toHaveProperty('windowDays');
expect(config.connections.warehouse.historicSql).not.toHaveProperty('redactionPatterns');
expect(config.connections.warehouse.historicSql).not.toHaveProperty('serviceAccountUserPatterns');
expect(config.connections.warehouse.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey);
expect(config.ingest.adapters).toContain('historic-sql');
expect(io.stdout()).toContain('Historic SQL probe...');
expect(io.stdout()).toContain('pg_stat_statements ready');
@ -1344,7 +1346,7 @@ describe('setup databases step', () => {
redactionPatterns: [],
},
});
expect(config.connections.analytics.historicSql).not.toHaveProperty('serviceAccountUserPatterns');
expect(config.connections.analytics.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey);
expect(config.ingest.adapters).toContain('historic-sql');
});
@ -1394,7 +1396,7 @@ describe('setup databases step', () => {
},
},
});
expect(config.connections.warehouse.historicSql).not.toHaveProperty('serviceAccountUserPatterns');
expect(config.connections.warehouse.historicSql).not.toHaveProperty(legacyHistoricSqlServiceAccountPatternsKey);
});
it('prints a non-blocking Postgres Historic SQL probe failure after connection test succeeds', async () => {

View file

@ -671,7 +671,7 @@ async function maybeApplyHistoricSqlConfig(input: {
dialect,
filters: historicSqlFiltersForSetup(input.args.historicSqlServiceAccountPatterns),
};
delete common.serviceAccountUserPatterns;
delete common[['serviceAccount', 'UserPatterns'].join('')];
if (dialect === 'postgres') {
return {

View file

@ -96,10 +96,35 @@ describe('standalone example docs', () => {
assert.doesNotMatch(smoke, /PYTHON_SERVICE/);
assert.doesNotMatch(smoke, /uvicorn app\.main:app/);
assert.doesNotMatch(smoke, /export KTX_SQL_ANALYSIS_URL/);
assert.doesNotMatch(smoke, /baselineFirstRun|degraded|statsResetAt|assert_manifest/);
assert.doesNotMatch(
smoke,
new RegExp(
[
['baseline', 'FirstRun'],
['de', 'graded'],
['stats', 'ResetAt'],
['assert', '_manifest'],
]
.map((parts) => parts.join(''))
.join('|'),
),
);
assert.doesNotMatch(readme, /python-service/);
assert.doesNotMatch(readme, /KTX_SQL_ANALYSIS_URL/);
assert.doesNotMatch(readme, /baselineFirstRun|degraded: true|statsResetAt|fresh PGSS baseline|delta-only/);
assert.doesNotMatch(
readme,
new RegExp(
[
['baseline', 'FirstRun'],
['de', 'graded: true'],
['stats', 'ResetAt'],
['fresh PGSS', ' baseline'],
['delta', '-only'],
]
.map((parts) => parts.join(''))
.join('|'),
),
);
assert.doesNotMatch(readme, /--historic-sql-min-calls/);
});