diff --git a/agent/consul/leader.go b/agent/consul/leader.go index f5b0cec6af..0c5b4b50d2 100644 --- a/agent/consul/leader.go +++ b/agent/consul/leader.go @@ -569,6 +569,7 @@ func (s *Server) legacyACLTokenUpgrade(ctx context.Context) error { if len(tokens) == 0 { // No new legacy tokens can be created, so we can exit + s.stopACLUpgrade() // required to prevent goroutine leak, according to TestAgentLeaks_Server return nil } diff --git a/agent/routine-leak-checker/leak_test.go b/agent/routine-leak-checker/leak_test.go index abc6ab6dbd..7b8de34c7c 100644 --- a/agent/routine-leak-checker/leak_test.go +++ b/agent/routine-leak-checker/leak_test.go @@ -6,12 +6,13 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/require" + "go.uber.org/goleak" + "github.com/hashicorp/consul/agent" "github.com/hashicorp/consul/sdk/testutil" "github.com/hashicorp/consul/testrpc" "github.com/hashicorp/consul/tlsutil" - "github.com/stretchr/testify/require" - "go.uber.org/goleak" ) func testTLSCertificates(serverName string) (cert string, key string, cacert string, err error) {