From aeb0a035372cdf7f76c83256eb881aefd15ea5bd Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 21 Dec 2022 22:28:56 +0800 Subject: [PATCH 1/2] Remove test session cache to reduce possible concurrent problem --- tests/integration/integration_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index 3537409aebf26..911d9ddf4c77c 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -209,8 +209,6 @@ func (s *TestSession) MakeRequestNilResponseHashSumRecorder(t testing.TB, req *h const userPassword = "password" -var loginSessionCache = make(map[string]*TestSession, 10) - func emptyTestSession(t testing.TB) *TestSession { t.Helper() jar, err := cookiejar.New(nil) @@ -225,12 +223,8 @@ func getUserToken(t testing.TB, userName string) string { func loginUser(t testing.TB, userName string) *TestSession { t.Helper() - if session, ok := loginSessionCache[userName]; ok { - return session - } - session := loginUserWithPassword(t, userName, userPassword) - loginSessionCache[userName] = session - return session + + return loginUserWithPassword(t, userName, userPassword) } func loginUserWithPassword(t testing.TB, userName, password string) *TestSession { From 76fc97d785cb03bc092744e4ba09bedbb761a3fe Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 21 Dec 2022 22:33:14 +0800 Subject: [PATCH 2/2] Fix lint --- tests/integration/signout_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/integration/signout_test.go b/tests/integration/signout_test.go index 0416930c6724e..0e822ac04e96c 100644 --- a/tests/integration/signout_test.go +++ b/tests/integration/signout_test.go @@ -21,7 +21,4 @@ func TestSignOut(t *testing.T) { // try to view a private repo, should fail req = NewRequest(t, "GET", "/user2/repo2") session.MakeRequest(t, req, http.StatusNotFound) - - // invalidate cached cookies for user2, for subsequent tests - delete(loginSessionCache, "user2") }