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 messages for tests
  • Loading branch information
N2D4 committed Feb 16, 2026
commit cbe7611e84ce595bf3511f44b07fd874b179d997
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { wait } from "@stackframe/stack-shared/dist/utils/promises";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
import { wait } from "@stackframe/stack-shared/dist/utils/promises";
import { Client } from 'pg';
import { afterAll, beforeAll, describe, expect } from 'vitest';
import { test } from '../../../../helpers';
import { InternalApiKey, Project, User, backendContext, niceBackendFetch } from '../../../backend-helpers';
import { InternalApiKey, User, backendContext, niceBackendFetch } from '../../../backend-helpers';
import {
HIGH_VOLUME_TIMEOUT,
POSTGRES_HOST,
Expand Down Expand Up @@ -39,18 +39,17 @@
query: "SELECT primary_email, display_name FROM users WHERE primary_email = {email:String}",
params: { email },
});
if (
response.status === 200
&& Array.isArray(response.body?.result)
&& response.body.result.length === 1
&& response.body.result[0]?.display_name === expectedDisplayName
) {
expect(response).toMatchObject({
status: 200,
});
if (response.body.result.length === 1) {
expect(response.body.result[0].display_name).toBe(expectedDisplayName);
return response;
}
await wait(intervalMs);
}

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

Check failure on line 52 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-advanced.test.ts

View workflow job for this annotation

GitHub Actions / E2E Tests (Node 22.x, Freestyle mock)

tests/backend/endpoints/api/v1/external-db-sync-advanced.test.ts > External DB Sync - Advanced Tests > Cross-DB resilience: postgres down does not block ClickHouse sync

StackAssertionError: Timed out waiting for ClickHouse user cross-db-resilience@example.com to sync. This is likely an error in Stack. Please make sure you are running the newest version and report it. ❯ waitForClickhouseUser tests/backend/endpoints/api/v1/external-db-sync-advanced.test.ts:52:9 ❯ tests/backend/endpoints/api/v1/external-db-sync-advanced.test.ts:1194:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { extraData: undefined, customCaptureExtraArgs: [ undefined ] }
}

describe.sequential('External DB Sync - Advanced Tests', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { wait } from "@stackframe/stack-shared/dist/utils/promises";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
import { wait } from "@stackframe/stack-shared/dist/utils/promises";
import { afterAll, beforeAll, describe, expect } from 'vitest';
import { test } from '../../../../helpers';
import { Project, User, niceBackendFetch } from '../../../backend-helpers';
Expand All @@ -9,7 +9,6 @@
createProjectWithExternalDb as createProjectWithExternalDbRaw,
verifyInExternalDb,
verifyNotInExternalDb,
waitForCondition,
waitForSyncedData,
waitForSyncedDeletion,
waitForTable
Expand All @@ -35,12 +34,11 @@
email,
},
});
if (
response.status === 200
&& Array.isArray(response.body?.result)
&& response.body.result.length === 1
&& response.body.result[0]?.display_name === expectedDisplayName
) {
expect(response).toMatchObject({
status: 200,
});
if (response.body.result.length === 1) {
expect(response.body.result[0].display_name).toBe(expectedDisplayName);

Check failure on line 41 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / E2E Tests (Node 22.x, Freestyle mock)

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Updates to user are synced to ClickHouse

AssertionError: expected 'Before CH Update' to be 'After CH Update' // Object.is equality - Expected + Received - After CH Update + Before CH Update ❯ waitForClickhouseUser tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:41:52 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:115:22

Check failure on line 41 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Updates to user are synced to ClickHouse

AssertionError: expected 'Before CH Update' to be 'After CH Update' // Object.is equality - Expected + Received - After CH Update + Before CH Update ❯ waitForClickhouseUser tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:41:52 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:115:22
return response;
}
await wait(intervalMs);
Expand All @@ -48,7 +46,7 @@

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

Check failure on line 49 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / Test migrations with dev branch code

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Updates to user are synced to ClickHouse

StackAssertionError: Timed out waiting for ClickHouse user clickhouse-update@example.com to sync. This is likely an error in Stack. Please make sure you are running the newest version and report it. ❯ waitForClickhouseUser tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:49:9 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:118:22 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { extraData: undefined, customCaptureExtraArgs: [ undefined ] }

Check failure on line 49 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / Test migrations with dev branch code

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Updates to user are synced to ClickHouse

StackAssertionError: Timed out waiting for ClickHouse user clickhouse-update@example.com to sync. This is likely an error in Stack. Please make sure you are running the newest version and report it. ❯ waitForClickhouseUser tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:49:9 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:118:22 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { extraData: undefined, customCaptureExtraArgs: [ undefined ] }
async function waitForClickhouseUserDeletion(email: string) {
const timeoutMs = 180_000;
const intervalMs = 2_000;
Expand All @@ -61,12 +59,11 @@
email,
},
});
if (
response.status === 200
&& Array.isArray(response.body?.result)
&& response.body.result.length === 0
) {
return;
expect(response).toMatchObject({

Check failure on line 62 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / E2E Tests (Node 22.x, Freestyle mock)

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Deleted user is removed from ClickHouse view

AssertionError: expected NiceResponse{ status: 401, …(3) } to match object { status: 200 } (9 matching properties omitted from actual) - Expected + Received Object { - "status": 200, + "status": 401, } ❯ waitForClickhouseUserDeletion tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:62:22 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:140:5

Check failure on line 62 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Deleted user is removed from ClickHouse view

AssertionError: expected NiceResponse{ status: 401, …(3) } to match object { status: 200 } (9 matching properties omitted from actual) - Expected + Received Object { - "status": 200, + "status": 401, } ❯ waitForClickhouseUserDeletion tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:62:22 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:140:5
status: 200,
});
if (response.body.result.length === 0) {
return response;
}
await wait(intervalMs);
}
Expand All @@ -74,7 +71,7 @@
throw new StackAssertionError(`Timed out waiting for ClickHouse user ${email} to be deleted.`);
}

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

Check failure on line 74 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / Test migrations with dev branch code

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Deleted user is removed from ClickHouse view

StackAssertionError: Timed out waiting for ClickHouse user clickhouse-delete@example.com to be deleted. This is likely an error in Stack. Please make sure you are running the newest version and report it. ❯ waitForClickhouseUserDeletion tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:74:9 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:143:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { extraData: undefined, customCaptureExtraArgs: [ undefined ] }

Check failure on line 74 in apps/e2e/tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts

View workflow job for this annotation

GitHub Actions / Test migrations with dev branch code

tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts > External DB Sync - Basic Tests > Deleted user is removed from ClickHouse view

StackAssertionError: Timed out waiting for ClickHouse user clickhouse-delete@example.com to be deleted. This is likely an error in Stack. Please make sure you are running the newest version and report it. ❯ waitForClickhouseUserDeletion tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:74:9 ❯ tests/backend/endpoints/api/v1/external-db-sync-basics.test.ts:143:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { extraData: undefined, customCaptureExtraArgs: [ undefined ] }
describe.sequential('External DB Sync - Basic Tests', () => {
let dbManager: TestDbManager;
const createProjectWithExternalDb = (
Expand Down
Loading