Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix ErrorContains #9445

Merged
merged 1 commit into from May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions server/server_test.go
Expand Up @@ -614,7 +614,8 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
assert.Equal(t, testDataCopy.expectedClaims, claims)
}
if testDataCopy.expectedErrorContains != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorContains, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorContains)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -657,7 +658,8 @@ func TestAuthenticate_no_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorContains != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorContains, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorContains)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -704,7 +706,8 @@ func TestAuthenticate_no_SSO(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorMessage, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorMessage)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -807,7 +810,8 @@ func TestAuthenticate_bad_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorMessage, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorMessage)
} else {
assert.NoError(t, err)
}
Expand Down