Skip to content

Commit be2595b

Browse files
Update e2e tests and right size prev fix attempts (#8234)
1 parent 5a3d918 commit be2595b

3 files changed

Lines changed: 15 additions & 39 deletions

File tree

e2e/helpers/usage.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,20 @@ export function createUsageHelper(
8383
expect(responseStatus).toBe(200);
8484
},
8585
async expectInsightOperation(operationName) {
86-
await expect
87-
.poll(
88-
async () => {
89-
await reloadInsightsPage();
90-
91-
return page.getByRole('link').filter({ hasText: operationName }).count();
92-
},
93-
{ timeout: 60_000, intervals: [2_000] },
94-
)
95-
.toBeGreaterThan(0);
86+
const link = page.getByRole('link').filter({ hasText: operationName });
87+
await expect(async () => {
88+
await reloadInsightsPage();
89+
// Reload re-fetches; wait for the row to render before retrying so a slow load
90+
// isn't reloaded away mid-flight.
91+
await expect(link.first()).toBeVisible({ timeout: 15_000 });
92+
}).toPass({ timeout: 90_000, intervals: [1_000] });
9693
},
9794
async expectInsightVersion(version) {
98-
await expect
99-
.poll(
100-
async () => {
101-
await reloadInsightsPage();
102-
103-
return page.getByText(version, { exact: true }).count();
104-
},
105-
{ timeout: 60_000, intervals: [2_000] },
106-
)
107-
.toBeGreaterThan(0);
95+
const versionText = page.getByText(version, { exact: true });
96+
await expect(async () => {
97+
await reloadInsightsPage();
98+
await expect(versionText.first()).toBeVisible({ timeout: 15_000 });
99+
}).toPass({ timeout: 90_000, intervals: [1_000] });
108100
},
109101
};
110102
}

e2e/specs/usage.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import type { AppHelper } from '../helpers/app';
44
import { generateRandomSlug, getUserData } from '../helpers/data';
55
import type { UsageHelper } from '../helpers/usage';
66

7-
// Each test waits on ClickHouse ingestion through several stacked polls (see helpers/usage.ts).
8-
// Keep the timeout above the sum of those poll budgets so a slow-but-succeeding poll isn't cut
9-
// off mid-wait by the per-test deadline.
10-
test.describe.configure({ mode: 'serial', timeout: 180_000 });
7+
// Generous per-test budget: each test drives the full org/project/target/token setup through
8+
// the UI before polling Insights.
9+
test.describe.configure({ mode: 'serial', timeout: 120_000 });
1110

1211
type UsageReport = {
1312
size: number;

packages/services/usage-ingestor/src/writer.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ export function createWriter({
5757
https: httpsAgent,
5858
};
5959

60-
logger.debug(
61-
'ClickHouse writer initialized (async_insert=1, wait_for_async_insert=%s, async_insert_busy_timeout_ms=%s, async_insert_max_data_size=%s)',
62-
clickhouse.wait_for_async_insert,
63-
clickhouse.async_insert_busy_timeout_ms,
64-
clickhouse.async_insert_max_data_size,
65-
);
66-
6760
return {
6861
async writeOperations(operations: string[]) {
6962
if (operations.length === 0) {
@@ -73,7 +66,6 @@ export function createWriter({
7366
const csv = joinIntoSingleMessage(operations);
7467
const compressed = await compress(csv);
7568

76-
const startedAt = performance.now();
7769
await writeCsv(
7870
clickhouse,
7971
agents,
@@ -82,13 +74,6 @@ export function createWriter({
8274
logger,
8375
3,
8476
);
85-
// With wait_for_async_insert=1 this blocks until the row is flushed (queryable);
86-
// fire-and-forget returns in a few ms. Logged at debug so it stays out of prod (info).
87-
logger.debug(
88-
'operations INSERT completed in %sms (operations=%s)',
89-
performance.now() - startedAt,
90-
operations.length,
91-
);
9277
},
9378
async writeSubscriptionOperations(operations: string[]) {
9479
if (operations.length === 0) {

0 commit comments

Comments
 (0)