Merge branch 'develop' into GRA-1217-tests

This commit is contained in:
Matthew R Kasun
2023-02-28 10:21:26 -05:00
committed by GitHub
65 changed files with 1527 additions and 1390 deletions

View File

@@ -2,39 +2,32 @@ package logic
import (
"context"
"fmt"
"net"
"os"
"testing"
"github.com/google/uuid"
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/models"
"github.com/matryer/is"
)
func TestMain(m *testing.M) {
func TestCheckPorts(t *testing.T) {
database.InitializeDatabase()
defer database.CloseDB()
CreateAdmin(&models.User{
UserName: "admin",
Password: "password",
IsAdmin: true,
Networks: []string{},
Groups: []string{},
})
peerUpdate := make(chan *models.Node)
go ManageZombies(context.Background(), peerUpdate)
go func() {
for update := range peerUpdate {
for y := range peerUpdate {
fmt.Printf("Pointless %v\n", y)
//do nothing
logger.Log(3, "received node update", update.Action)
}
}()
os.Exit(m.Run())
}
func TestCheckPorts(t *testing.T) {
h := models.Host{
ID: uuid.New(),
EndpointIP: net.ParseIP("192.168.1.1"),