mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
run cancel in defer
This commit is contained in:
@@ -259,6 +259,7 @@ func TestClient_Sync(t *testing.T) {
|
||||
ch := make(chan *mgmtProto.SyncResponse, 5)
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
go func() {
|
||||
err = client.Sync(ctx, info, func(msg *mgmtProto.SyncResponse) error {
|
||||
ch <- msg
|
||||
@@ -291,7 +292,6 @@ func TestClient_Sync(t *testing.T) {
|
||||
t.Error("timeout waiting for test to finish")
|
||||
}
|
||||
|
||||
cancel()
|
||||
}
|
||||
|
||||
func Test_SystemMetaDataFromClient(t *testing.T) {
|
||||
|
||||
@@ -317,6 +317,7 @@ var _ = Describe("Management service", func() {
|
||||
additionalPeers := 10
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var peers []wgtypes.Key
|
||||
for i := 0; i < initialPeers; i++ {
|
||||
@@ -379,7 +380,6 @@ var _ = Describe("Management service", func() {
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
cancel()
|
||||
|
||||
for _, syncClient := range clients {
|
||||
err := syncClient.CloseSend()
|
||||
|
||||
Reference in New Issue
Block a user