From b32d6b4e44d7b6ec97c517e7e74c449a687e510e Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Wed, 29 Mar 2023 17:36:12 -0600 Subject: [PATCH] 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 --- server/auth_callout_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/auth_callout_test.go b/server/auth_callout_test.go index ee218148a4..6486721a15 100644 --- a/server/auth_callout_test.go +++ b/server/auth_callout_test.go @@ -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{}}