mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
fix tests
This commit is contained in:
@@ -1,16 +1,38 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"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) {
|
||||
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 {
|
||||
//do nothing
|
||||
logger.Log(3, "received node update", update.Action)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func TestCheckPorts(t *testing.T) {
|
||||
initialize()
|
||||
h := models.Host{
|
||||
ID: uuid.New(),
|
||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||
|
Reference in New Issue
Block a user