Skip to content

Commit

Permalink
fix: test race (#9469)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
  • Loading branch information
crenshaw-dev committed May 20, 2022
1 parent f624015 commit 4a51875
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/server_test.go
Expand Up @@ -594,14 +594,15 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
},
}

ctx := context.Background()

for _, testData := range tests {
testDataCopy := testData

t.Run(testDataCopy.test, func(t *testing.T) {
t.Parallel()

// Must be declared here to avoid race.
ctx := context.Background() //nolint:ineffassign,staticcheck

argocd, dexURL := getTestServer(t, testDataCopy.anonymousEnabled, true)
testDataCopy.claims.Issuer = fmt.Sprintf("%s/api/dex", dexURL)
token := jwt.NewWithClaims(jwt.SigningMethodHS256, testDataCopy.claims)
Expand Down Expand Up @@ -690,14 +691,15 @@ func TestAuthenticate_no_SSO(t *testing.T) {
},
}

ctx := context.Background()

for _, testData := range tests {
testDataCopy := testData

t.Run(testDataCopy.test, func(t *testing.T) {
t.Parallel()

// Must be declared here to avoid race.
ctx := context.Background() //nolint:ineffassign,staticcheck

argocd, dexURL := getTestServer(t, testDataCopy.anonymousEnabled, false)
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{Issuer: fmt.Sprintf("%s/api/dex", dexURL)})
tokenString, err := token.SignedString([]byte("key"))
Expand Down

0 comments on commit 4a51875

Please sign in to comment.