Skip to content

flake: TestExpireAPIKey (multiple variants) #1623

Description

@flake-investigator

CI Run: https://github.com/coder/coder/actions/runs/29892773275
Job: test-go-pg (windows-2022)
Failure time: 2026-07-22 05:20:12Z
Commit: d485786dfe399d7607f17d971d4366724e8cd3e9 (Nick Vigilante)

Failing tests:

  • TestExpireAPIKey/AdminCanExpireOtherUsersToken
  • TestExpireAPIKey/DeletingExpiredTokenSucceeds
  • TestExpireAPIKey

Error snippet:

=== FAIL: coderd TestExpireAPIKey/AdminCanExpireOtherUsersToken (0.06s)
    apikey_test.go:608:
        Error:      Should be true
        Test:       TestExpireAPIKey/AdminCanExpireOtherUsersToken
--- FAIL: TestExpireAPIKey/AdminCanExpireOtherUsersToken (0.06s)

=== FAIL: coderd TestExpireAPIKey/DeletingExpiredTokenSucceeds (0.02s)
    apikey_test.go:688:
        Error:      Should be true
        Test:       TestExpireAPIKey/DeletingExpiredTokenSucceeds
--- FAIL: TestExpireAPIKey/DeletingExpiredTokenSucceeds (0.02s)

Context:

  • Both failures occur after calling ExpireAPIKey, where the test expects key.ExpiresAt.Before(dbtime.Now()) to be true but it remains false (token appears unexpired).
  • No panic/OOM/data race output found.

Root cause classification: Flaky test or timing issue around token expiry timestamps (ExpiresAt not observed as expired immediately after ExpireAPIKey on Windows).

Assignment analysis:

  • git log --oneline -10 --follow coderd/apikey_test.go
    • 8c8b307b9787 "fix: persist session cookie to disk to prevent PWA logout" (Kyle Carberry)
    • 81468323e08f "fix(coderd): use dbtime.Now() instead of time.Now() in test assertions against DB timestamps" (Cian Johnston)
  • Most recent meaningful changes touching apikey_test.go are by Kyle Carberry.

Related issues:

  • None found in coder/internal for TestExpireAPIKey/AdminCanExpireOtherUsersToken/DeletingExpiredTokenSucceeds.

Repro:

  • Not yet known; failure observed in CI only.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions