Skip to content

Commit

Permalink
Clean up codes
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Nov 1, 2024
1 parent 035634b commit c481be9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/integration/auth_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func TestAuthWebhookCache(t *testing.T) {
}

func TestAuthWebhookNewToken(t *testing.T) {
t.Run("set new token when receiving invalid token test", func(t *testing.T) {
t.Run("set valid token after invalid token test", func(t *testing.T) {
ctx := context.Background()
authServer, validToken := newAuthServer(t)

Expand Down Expand Up @@ -636,15 +636,15 @@ func TestAuthWebhookNewToken(t *testing.T) {
defer func() { assert.NoError(t, cli.Close()) }()

err = cli.Activate(ctx)
// reactivate with new token
if err != nil {
metadata := converter.ErrorMetadataOf(err)
if metadata["reason"] == "invalid token" {
err = cli.SetToken(validToken)
assert.NoError(t, err)
err = cli.Activate(ctx)
assert.NoError(t, err)
}
assert.Equal(t, connect.CodeUnauthenticated, connect.CodeOf(err))

// activate again with valid token
metadata := converter.ErrorMetadataOf(err)
if metadata["reason"] == "invalid token" {
err = cli.SetToken(validToken)
assert.NoError(t, err)
err = cli.Activate(ctx)
assert.NoError(t, err)
}
})
}

0 comments on commit c481be9

Please sign in to comment.