Skip to content

Commit 8c1bb77

Browse files
authored
Remove test session cache to reduce possible concurrent problem (#22199)
1 parent ac5b44b commit 8c1bb77

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

tests/integration/integration_test.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ func (s *TestSession) MakeRequestNilResponseHashSumRecorder(t testing.TB, req *h
209209

210210
const userPassword = "password"
211211

212-
var loginSessionCache = make(map[string]*TestSession, 10)
213-
214212
func emptyTestSession(t testing.TB) *TestSession {
215213
t.Helper()
216214
jar, err := cookiejar.New(nil)
@@ -225,12 +223,8 @@ func getUserToken(t testing.TB, userName string) string {
225223

226224
func loginUser(t testing.TB, userName string) *TestSession {
227225
t.Helper()
228-
if session, ok := loginSessionCache[userName]; ok {
229-
return session
230-
}
231-
session := loginUserWithPassword(t, userName, userPassword)
232-
loginSessionCache[userName] = session
233-
return session
226+
227+
return loginUserWithPassword(t, userName, userPassword)
234228
}
235229

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

tests/integration/signout_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,4 @@ func TestSignOut(t *testing.T) {
2121
// try to view a private repo, should fail
2222
req = NewRequest(t, "GET", "/user2/repo2")
2323
session.MakeRequest(t, req, http.StatusNotFound)
24-
25-
// invalidate cached cookies for user2, for subsequent tests
26-
delete(loginSessionCache, "user2")
2724
}

0 commit comments

Comments
 (0)