Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better error logging when db sync fails
  • Loading branch information
N2D4 committed Feb 16, 2026
commit 836eb6588f0d816eaaf8c1a9114dc2624435cd41
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ async function waitForClickhouseUser(email: string, expectedDisplayName: string)
const intervalMs = 2_000;
const start = performance.now();

let response;
while (performance.now() - start < timeoutMs) {
const response = await runQueryForCurrentProject({
response = await runQueryForCurrentProject({
query: "SELECT primary_email, display_name FROM users WHERE primary_email = {email:String}",
params: { email },
});
Expand All @@ -51,7 +52,7 @@ async function waitForClickhouseUser(email: string, expectedDisplayName: string)
await wait(intervalMs);
}

throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to sync.`);
throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to sync.`, { response });
}

describe.sequential('External DB Sync - Advanced Tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ async function waitForClickhouseUser(email: string, expectedDisplayName: string)
const intervalMs = 2_000;
const start = performance.now();

let response;
while (performance.now() - start < timeoutMs) {
const response = await runQueryForCurrentProject({
response = await runQueryForCurrentProject({
query: "SELECT primary_email, display_name FROM users WHERE primary_email = {email:String}",
params: {
email,
Expand All @@ -44,16 +45,20 @@ async function waitForClickhouseUser(email: string, expectedDisplayName: string)
await wait(intervalMs);
}

throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to sync.`);
throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to sync.`, { response });
}

async function waitForClickhouseUserDeletion(email: string) {
// ensure we definitely have project keys that don't expire (unlike an admin access token)
await InternalApiKey.createAndSetProjectKeys();

const timeoutMs = 180_000;
const intervalMs = 2_000;
const start = performance.now();

let response;
while (performance.now() - start < timeoutMs) {
const response = await runQueryForCurrentProject({
response = await runQueryForCurrentProject({
query: "SELECT primary_email FROM users WHERE primary_email = {email:String}",
params: {
email,
Expand All @@ -68,7 +73,7 @@ async function waitForClickhouseUserDeletion(email: string) {
await wait(intervalMs);
}

throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to be deleted.`);
throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to be deleted.`, { response });
}

// Run tests sequentially to avoid concurrency issues with shared backend state
Expand Down
Loading