Skip to content

Commit

Permalink
remove ErrUnsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffy-mathew committed Dec 29, 2023
1 parent e4b09bb commit 2656183
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gateway/oauth_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const keyRulesWithMetadata = `{
"meta_data": {"key": "meta", "foo": "keybar"}
}`

var (
dummyErr = errors.New("dummy")
)

func buildTestOAuthSpec(apiGens ...func(spec *APISpec)) *APISpec {
return BuildAPI(func(spec *APISpec) {
spec.APIID = "999999"
Expand Down Expand Up @@ -1405,9 +1409,9 @@ func TestPurgeOAuthClientTokens(t *testing.T) {
redisController := storage.NewRedisController(context.Background())
redisController.MockWith(db, true)
gw.RedisController = redisController
mock.ExpectSetNX("oauth-purge-lock", "1", time.Minute).SetErr(errors.ErrUnsupported)
mock.ExpectSetNX("oauth-purge-lock", "1", time.Minute).SetErr(dummyErr)
err := gw.purgeLapsedOAuthTokens()
assert.ErrorIs(t, err, errors.ErrUnsupported)
assert.ErrorIs(t, err, dummyErr)
})

t.Run("lock failure", func(t *testing.T) {
Expand All @@ -1434,9 +1438,9 @@ func TestPurgeOAuthClientTokens(t *testing.T) {
redisController.MockWith(db, true)
gw.RedisController = redisController
mock.ExpectSetNX("oauth-purge-lock", "1", time.Minute).SetVal(true)
mock.ExpectScan(0, oAuthClientTokensKeyPattern, 0).SetErr(errors.ErrUnsupported)
mock.ExpectScan(0, oAuthClientTokensKeyPattern, 0).SetErr(dummyErr)
err := gw.purgeLapsedOAuthTokens()
assert.ErrorIs(t, err, errors.ErrUnsupported)
assert.ErrorIs(t, err, dummyErr)
})
})
}
Expand Down

0 comments on commit 2656183

Please sign in to comment.