Browse Source

Remove test session cache to reduce possible concurrent problem (#22199)

tags/v1.19.0-rc0
Lunny Xiao 1 year ago
parent
commit
8c1bb77437
No account linked to committer's email address
2 changed files with 2 additions and 11 deletions
  1. 2
    8
      tests/integration/integration_test.go
  2. 0
    3
      tests/integration/signout_test.go

+ 2
- 8
tests/integration/integration_test.go View File

@@ -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 {

+ 0
- 3
tests/integration/signout_test.go View File

@@ -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")
}

Loading…
Cancel
Save