-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
coder/coder
#22654Labels
Description
CI Failure
- Run: https://github.com/coder/coder/actions/runs/22696490670
- Job:
test-go-pg (windows-2022) - Commit: 6afcc7b90456bca200841b2da93dfa84b2bb7490 (Kyle Carberry)
Failure Output
--- FAIL: TestTokens
tokens_test.go:191:
Error Trace: C:/actions-runner/coder/coder/cli/tokens_test.go:191
Error: Should be true
Relevant log context shows the admin tokens rm call succeeded, but the follow-up assertion failed:
clitest.go:86: invoking command: coder ... tokens rm oAqUzRa1fj
... PUT /api/v2/users/me/keys/oAqUzRa1fj/expire ... status_code=204
... tokens_test.go:191: Error: Should be true
Suspected Root Cause
Flaky test on Windows due to timing/clock precision around expiration. The test asserts:
require.True(t, token.ExpiresAt.Before(time.Now()))
ExpireAPIKey sets ExpiresAt using dbtime.Now() (UTC + microsecond rounding). On Windows (coarser clock resolution), ExpiresAt can be equal to or slightly after time.Now() at assertion time, causing intermittent failure.
Assignment Analysis
git blame -L 185,195 cli/tokens_test.go
- 4a3304fc38d0 (feat(cli)!: expire tokens by default) — added the failing assertion and the expire-path test
- Author: Cian Johnston (
johnstcn)
Notes
- No panic/OOM/race indicators in logs.
- Only failure in run; other OS jobs passed.
Suggested Fix
Relax the time assertion, e.g.:
require.False(t, token.ExpiresAt.After(time.Now())), or- compare against
time.Now().Add(1 * time.Second)/ useassert.WithinDuration.
Reactions are currently unavailable