Browse Source

acl: call stop for the upgrade goroutine when done

TestAgentLeaks_Server was reporting a goroutine leak without this. Not sure if it would actually
be a leak in production or if this is due to the test setup, but seems easy enough to call it
this way until we remove legacyACLTokenUpgrade.
pull/11182/head
Daniel Nephin 3 years ago
parent
commit
4faf805716
  1. 1
      agent/consul/leader.go
  2. 5
      agent/routine-leak-checker/leak_test.go

1
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
}

5
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) {

Loading…
Cancel
Save