fix(tests): wire settings registry into the test auth handler — unstick TestAdminCreateUser

setupTestServer built the settings registry (and wired it into
systemSettingsHandler) but never called authHandler.SetSettings, unlike
main.go:112. The auth handler therefore ran with a nil registry and
defaultTimezone() took its nil-fallback branch, returning "UTC" for every
Register/AdminCreateUser in tests regardless of the system default_timezone
setting — so the 740213f0 inheritance pin in TestAdminCreateUser could never
pass and failed every full-suite run.

Also replace the TestAdminCreateUser "stable-ish" uniquifier (MaxConns is
pinned to 1 by the harness, so it produced the same user every run and
depended on the next run's cleanup sweep) with a real uuid suffix.
This commit is contained in:
John O'Keefe committed 2026-10-20 19:02:26 -04:00
1 parent 91b0c45dd4
commit 19b9c7c9b8
2 files changed
+8 -2

No files matched your search

+4
View File
@@ -503,6 +503,10 @@ func setupTestServer(t *testing.T) *TestServerSetup {
conflictHandler := handlers.NewConflictHandler(queries, connManager, progressService)
analyticsHandler := handlers.NewAnalyticsHandler(queries)
queueHandler := handlers.NewQueueHandler(queries, queueProcessor)
// main.go:112 wires the registry into the auth handler too — without it
// defaultTimezone() short-circuits to UTC and every new user (Register +
// AdminCreateUser) ignores the system default_timezone setting in tests.
authHandler.SetSettings(settingsRegistry)
systemSettingsHandler := handlers.NewSystemSettingsHandler(queries)
systemSettingsHandler.SetSettings(settingsRegistry)
processingIssuesHandler := handlers.NewProcessingIssuesHandler(queries)