Skip to content

Commit

Permalink
fix(test): add missing closes to admin client tests
Browse files Browse the repository at this point in the history
These were leaking goroutines

Signed-off-by: Dominic Evans <[email protected]>
  • Loading branch information
dnwe committed Aug 11, 2023
1 parent a5b6e6a commit c89dfe9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ func TestClusterAdminInvalidController(t *testing.T) {

config := NewTestConfig()
config.Version = V1_0_0_0
_, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config)
if admin != nil {
defer safeClose(t, admin)
}
if err == nil {
t.Fatal(errors.New("controller not set still cluster admin was created"))
}
Expand Down
2 changes: 2 additions & 0 deletions functional_admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestFuncAdminQuotas(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer safeClose(t, adminClient)

// Check that we can read the quotas, and that they are empty
quotas, err := adminClient.DescribeClientQuotas(nil, false)
Expand Down Expand Up @@ -143,6 +144,7 @@ func TestFuncAdminDescribeGroups(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer safeClose(t, adminClient)

config1 := NewFunctionalTestConfig()
config1.ClientID = "M1"
Expand Down
4 changes: 4 additions & 0 deletions functional_consumer_staticmembership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func TestFuncConsumerGroupStaticMembership_Basic(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer safeClose(t, admin)

res, err := admin.DescribeConsumerGroups([]string{groupID})
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -93,6 +95,8 @@ func TestFuncConsumerGroupStaticMembership_RejoinAndLeave(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer safeClose(t, admin)

res1, err := admin.DescribeConsumerGroups([]string{groupID})
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit c89dfe9

Please sign in to comment.