Browse Source

update TestMain

Matthew R Kasun 2 years ago
parent
commit
3836bd1d36
4 changed files with 9 additions and 0 deletions
  1. 2 0
      controllers/network_test.go
  2. 3 0
      functions/helpers_test.go
  3. 2 0
      logic/host_test.go
  4. 2 0
      logic/pro/networkuser_test.go

+ 2 - 0
controllers/network_test.go

@@ -40,6 +40,8 @@ func TestMain(m *testing.M) {
 			logger.Log(3, "received node update", update.Action)
 			logger.Log(3, "received node update", update.Action)
 		}
 		}
 	}()
 	}()
+	os.Exit(m.Run())
+
 }
 }
 
 
 func TestCreateNetwork(t *testing.T) {
 func TestCreateNetwork(t *testing.T) {

+ 3 - 0
functions/helpers_test.go

@@ -3,6 +3,7 @@ package functions
 import (
 import (
 	"context"
 	"context"
 	"encoding/json"
 	"encoding/json"
+	"os"
 	"testing"
 	"testing"
 
 
 	"github.com/gravitl/netmaker/database"
 	"github.com/gravitl/netmaker/database"
@@ -39,6 +40,8 @@ func TestMain(m *testing.M) {
 			logger.Log(3, "received node update", update.Action)
 			logger.Log(3, "received node update", update.Action)
 		}
 		}
 	}()
 	}()
+	os.Exit(m.Run())
+
 }
 }
 
 
 func TestNetworkExists(t *testing.T) {
 func TestNetworkExists(t *testing.T) {

+ 2 - 0
logic/host_test.go

@@ -3,6 +3,7 @@ package logic
 import (
 import (
 	"context"
 	"context"
 	"net"
 	"net"
+	"os"
 	"testing"
 	"testing"
 
 
 	"github.com/google/uuid"
 	"github.com/google/uuid"
@@ -30,6 +31,7 @@ func TestMain(m *testing.M) {
 			logger.Log(3, "received node update", update.Action)
 			logger.Log(3, "received node update", update.Action)
 		}
 		}
 	}()
 	}()
+	os.Exit(m.Run())
 }
 }
 
 
 func TestCheckPorts(t *testing.T) {
 func TestCheckPorts(t *testing.T) {

+ 2 - 0
logic/pro/networkuser_test.go

@@ -1,6 +1,7 @@
 package pro
 package pro
 
 
 import (
 import (
+	"os"
 	"testing"
 	"testing"
 
 
 	"github.com/google/uuid"
 	"github.com/google/uuid"
@@ -13,6 +14,7 @@ import (
 func TestMain(m *testing.M) {
 func TestMain(m *testing.M) {
 	database.InitializeDatabase()
 	database.InitializeDatabase()
 	defer database.CloseDB()
 	defer database.CloseDB()
+	os.Exit(m.Run())
 }
 }
 
 
 func TestNetworkUserLogic(t *testing.T) {
 func TestNetworkUserLogic(t *testing.T) {