diff --git a/cmd/server/tests/ownership_and_admin_test.go b/cmd/server/tests/ownership_and_admin_test.go index accdda06..427f3759 100644 --- a/cmd/server/tests/ownership_and_admin_test.go +++ b/cmd/server/tests/ownership_and_admin_test.go @@ -183,8 +183,10 @@ func (s *OwnershipAndAdminTestSuite) TestHighlightDelete_CrossUserNoOp() { // create accounts even with self-service registration disabled, regular // users cannot, and duplicates conflict. func (s *OwnershipAndAdminTestSuite) TestAdminCreateUser() { - suffix := fmt.Sprintf("%d", s.setup.DBPool.Config().MaxConns) // stable-ish uniquifier - unique := fmt.Sprintf("admincreated%s", suffix) + // Real unique suffix: MaxConns is forced to 1 by the harness, so the old + // "stable-ish" uniquifier produced the same user every run and only + // survived on the setup-time cleanup sweep of the NEXT run. + unique := fmt.Sprintf("admincreated-%s", uuid.New().String()[:8]) // Regular user token → 403 (AdminMiddleware). payload, _ := json.Marshal(map[string]interface{}{ diff --git a/cmd/server/tests/test_helpers_test.go b/cmd/server/tests/test_helpers_test.go index dd8e120c..ca84928a 100644 --- a/cmd/server/tests/test_helpers_test.go +++ b/cmd/server/tests/test_helpers_test.go @@ -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)