Initialize auth stores in shard-order-sensitive internal/api tests

TestEstablishSAMLSession panicked when refreshed internal/api shard weights
placed it in api-3 before any test initialized the package-level session and
CSRF stores (run 46133585552, job 140948795581). Initialize and restore the
test auth stores via useSAMLTestAuthStores(t) in TestEstablishSAMLSession
and newHostedAuthzTestRouter so both suites remain self-contained regardless
of shard cut boundaries.

Contract-Neutral: Test-only initialization fix for existing internal/api unit tests; no production behavior or subsystem contract changes.
Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-11-28 10:56:09 +00:00
parent ac21b37f96
commit 27193e5d78
2 changed files with 4 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ import (
)
func newHostedAuthzTestRouter(t *testing.T) *Router {
t.Helper()
useSAMLTestAuthStores(t)
baseDir := t.TempDir()
hashed, err := internalauth.HashPassword("Password!1")

View File

@@ -94,6 +94,8 @@ func TestHandleSAMLLogout_Fallback(t *testing.T) {
}
func TestEstablishSAMLSession(t *testing.T) {
useSAMLTestAuthStores(t)
router := &Router{}
req := httptest.NewRequest(http.MethodGet, "/", nil)
rec := httptest.NewRecorder()