Fixed callout tests that were not doing cleanup causing data races

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>
This commit is contained in:
Ivan Kozlovic
2023-03-29 17:36:12 -06:00
parent 3d495435c0
commit b32d6b4e44

View File

@@ -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{}}
@@ -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.
@@ -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{}}