mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 11:48:43 -07:00
Fixed some tests to manually close account resolver
Those tests don't really start the server, so the account resolver's internal expiration routine would be left running. Doing an explicit close solves this issue. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -5755,6 +5755,9 @@ func TestJWTNoSystemAccountButNatsResolver(t *testing.T) {
|
||||
defer removeFile(t, conf)
|
||||
opts := LoadConfig(conf)
|
||||
s, err := NewServer(opts)
|
||||
// Since the server cannot be stopped, since it did not start,
|
||||
// let's manually close the account resolver to avoid leaking go routines.
|
||||
opts.AccountResolver.Close()
|
||||
s.Shutdown()
|
||||
require_Error(t, err)
|
||||
require_Contains(t, err.Error(), "the system account needs to be specified in configuration or the operator jwt")
|
||||
|
||||
@@ -2496,6 +2496,9 @@ func TestLeafNodeOperatorBadCfg(t *testing.T) {
|
||||
s.Shutdown()
|
||||
t.Fatal("Expected an error")
|
||||
}
|
||||
// Since the server cannot be stopped, since it did not start,
|
||||
// let's manually close the account resolver to avoid leaking go routines.
|
||||
opts.AccountResolver.Close()
|
||||
if err.Error() != errorText {
|
||||
t.Fatalf("Expected error %s but got %s", errorText, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user