Abhishek Kondur 1 tahun lalu
induk
melakukan
c3b94ed048
3 mengubah file dengan 12 tambahan dan 3 penghapusan
  1. 4 1
      controllers/network_test.go
  2. 4 1
      functions/helpers_test.go
  3. 4 1
      logic/host_test.go

+ 4 - 1
controllers/network_test.go

@@ -3,6 +3,7 @@ package controller
 import (
 	"context"
 	"os"
+	"sync"
 	"testing"
 
 	"github.com/google/uuid"
@@ -31,7 +32,9 @@ func TestMain(m *testing.M) {
 		IsAdmin:  true,
 	})
 	peerUpdate := make(chan *models.Node)
-	go logic.ManageZombies(context.Background(), peerUpdate)
+	wg := &sync.WaitGroup{}
+	wg.Add(1)
+	go logic.ManageZombies(context.Background(), wg, peerUpdate)
 	go func() {
 		for update := range peerUpdate {
 			//do nothing

+ 4 - 1
functions/helpers_test.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"encoding/json"
 	"os"
+	"sync"
 	"testing"
 
 	"github.com/gravitl/netmaker/database"
@@ -31,7 +32,9 @@ func TestMain(m *testing.M) {
 		IsSuperAdmin: true,
 	})
 	peerUpdate := make(chan *models.Node)
-	go logic.ManageZombies(context.Background(), peerUpdate)
+	wg := &sync.WaitGroup{}
+	wg.Add(1)
+	go logic.ManageZombies(context.Background(), wg, peerUpdate)
 	go func() {
 		for update := range peerUpdate {
 			//do nothing

+ 4 - 1
logic/host_test.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"net"
 	"os"
+	"sync"
 	"testing"
 
 	"github.com/google/uuid"
@@ -14,10 +15,12 @@ import (
 )
 
 func TestMain(m *testing.M) {
+	wg := &sync.WaitGroup{}
 	database.InitializeDatabase()
 	defer database.CloseDB()
 	peerUpdate := make(chan *models.Node)
-	go ManageZombies(context.Background(), peerUpdate)
+	wg.Add(1)
+	go ManageZombies(context.Background(), wg, peerUpdate)
 	go func() {
 		for y := range peerUpdate {
 			fmt.Printf("Pointless %v\n", y)