Skip to content

Commit

Permalink
Fix goroutine leak when test with an empty node list
Browse files Browse the repository at this point in the history
  • Loading branch information
Xu Xiaofan committed Oct 10, 2024
1 parent e7ce532 commit 3651439
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ func TestChannelCreation(t *testing.T) {
if err != nil {
t.Fatal(err)
}
//the node should be closed manually because it isn't added to the configuration
defer node.close()
mgr := dummyMgr()
defer mgr.Close()
// a proper connection should NOT be established here
node.connect(mgr)

Expand Down Expand Up @@ -117,8 +118,9 @@ func TestChannelReconnection(t *testing.T) {
if err != nil {
t.Fatal(err)
}
//the node should be closed manually because it isn't added to the configuration
defer node.close()
mgr := dummyMgr()
defer mgr.Close()
// a proper connection should NOT be established here because server is not started
node.connect(mgr)

Expand Down

0 comments on commit 3651439

Please sign in to comment.