Skip to content

Commit

Permalink
Fixed callout tests that were not doing cleanup causing data races
Browse files Browse the repository at this point in the history
Because of the lack of `defer ac.Cleanup()` in some tests, the
accounts would still try to send conn updates, which was possibly
causing data races with some of the tests that change the
eventsHBInterval global variable.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
  • Loading branch information
kozlovic committed Mar 30, 2023
1 parent ad9220d commit b907112
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/auth_callout_test.go
Expand Up @@ -558,6 +558,7 @@ func TestAuthCalloutOperatorModeBasics(t *testing.T) {
}

ac := NewAuthTest(t, conf, handler, nats.UserCredentials(creds))
defer ac.Cleanup()
resp, err := ac.authClient.Request(userDirectInfoSubj, nil, time.Second)
require_NoError(t, err)
response := ServerAPIResponse{Data: &UserInfo{}}
Expand Down Expand Up @@ -795,6 +796,7 @@ func TestAuthCalloutOperatorModeEncryption(t *testing.T) {
}

ac := NewAuthTest(t, conf, handler, nats.UserCredentials(creds))
defer ac.Cleanup()

// Bearer token etc..
// This is used by all users, and the customization will be in other connect args.
Expand Down Expand Up @@ -1382,6 +1384,7 @@ func TestAuthCalloutOperator_AnyAccount(t *testing.T) {
}

ac := NewAuthTest(t, conf, handler, nats.UserCredentials(creds))
defer ac.Cleanup()
resp, err := ac.authClient.Request(userDirectInfoSubj, nil, time.Second)
require_NoError(t, err)
response := ServerAPIResponse{Data: &UserInfo{}}
Expand Down

0 comments on commit b907112

Please sign in to comment.