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 authored and alexmt committed May 24, 2022
1 parent cd09863 commit 078cfe1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/server_test.go
Original file line number Diff line number Diff line change
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 078cfe1

Please sign in to comment.