Skip to content

Commit

Permalink
Merge pull request #190 from xuxiaofan1203/avoid-goroutine-leak
Browse files Browse the repository at this point in the history
Fix goroutine leak when test with an empty node list
  • Loading branch information
meling authored Oct 10, 2024
2 parents e7ce532 + 3651439 commit def9894
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 def9894

Please sign in to comment.