Fix flaky charts integration test due to minute-boundary timing (#1923)

## Summary

- Fixes flaky integration test in `charts.test.ts` where 12 of 27 tests intermittently fail
- Root cause: test data timestamps (`now` and `now + 1000`) sometimes straddle a ClickHouse 1-minute time bucket boundary, producing 2 rows instead of the expected 1
- Fix: floor the base timestamp to the start of the minute so both data points always land in the same bucket

## Failing CI run

https://github.com/hyperdxio/hyperdx/actions/runs/23056501733/job/66971286014
This commit is contained in:
Warren Lee 2026-03-16 11:19:18 -07:00 committed by GitHub
parent e09c8c0e5d
commit 81fe186e8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,7 +18,10 @@ import Connection from '../../../models/connection';
import { ISource, Source } from '../../../models/source';
// Default time range for tests (1 hour)
const DEFAULT_END_TIME = Date.now();
// Floor to minute so all derived timestamps (including test data inserted at
// `now` and `now + 1000`) always fall within the same 1-minute ClickHouse time
// bucket, preventing flaky results when timestamps straddle a minute boundary.
const DEFAULT_END_TIME = Math.floor(Date.now() / 60000) * 60000;
const DEFAULT_START_TIME = DEFAULT_END_TIME - 3600 * 1000;
// Helper to create standard series request payload