Skip to content

Commit 89cd4dd

Browse files
ethantkoeniglunny
authored andcommitted
Cache session cookies in tests (#2128)
1 parent 4c57db7 commit 89cd4dd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

integrations/integration_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,15 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu
158158

159159
const userPassword = "password"
160160

161+
var loginSessionCache = make(map[string]*TestSession, 10)
162+
161163
func loginUser(t testing.TB, userName string) *TestSession {
162-
return loginUserWithPassword(t, userName, userPassword)
164+
if session, ok := loginSessionCache[userName]; ok {
165+
return session
166+
}
167+
session := loginUserWithPassword(t, userName, userPassword)
168+
loginSessionCache[userName] = session
169+
return session
163170
}
164171

165172
func loginUserWithPassword(t testing.TB, userName, password string) *TestSession {

0 commit comments

Comments
 (0)