Flaky test: "if-modified-since is over 30 ago"
benvinegar opened this issue · 2 comments
benvinegar commented
I noticed this test started failing at 11:00 PM EST. It does mess with dates/timezones, etc so likely a situation where the day boundaries aren't accounting for timezones.
This could be a problem with the test (because it populates test data with dates/timestamps), or it could be that we're not respecting timezones properly in our if-modified-since
server handler.
✓ app/analytics/query.test.ts (6)
❯ app/analytics/collect.test.ts (5)
❯ collectRequestHandler (5)
✓ invokes writeDataPoint with transformed params
✓ if-modified-since is absent
✓ if-modified-since is within 30 minutes
× if-modified-since is over 30 ago
✓ if-modified-since was yesterday
✓ app/routes/_index.test.tsx (1)
✓ app/routes/dashboard.test.tsx (2)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL app/analytics/collect.test.ts > collectRequestHandler > if-modified-since is over 30 ago
AssertionError: expected { indexes: [ 'example' ], …(2) } to have property "doubles" with value [ +0, 1 ]
- Expected
+ Received
Array [
- 0,
+ 1,
1,
]
❯ app/analytics/collect.test.ts:131:58
129|
130| const writeDataPoint = env.WEB_COUNTER_AE.writeDataPoint;
131| expect((writeDataPoint as any).mock.calls[0][0]).toHaveProperty("doubles", [
| ^
132| 0, // new visitor
133| 1, // new session
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed | 3 passed (4)
Tests 1 failed | 13 passed (14)
Start at 00:26:19
Duration 895ms (transform 86ms, setup 0ms, collect 802ms, tests 71ms, environment 497ms, prepare 135ms)
benvinegar commented
This is happening on CI too:
https://github.com/benvinegar/counterscale/actions/runs/7825307406/job/21349268716#step:8:13
benvinegar commented
Fixed in 9e0d734