mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-27 05:08:11 +08:00
use channels for sync
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gravitl/netmaker/database"
|
|
||||||
"github.com/gravitl/netmaker/logic"
|
"github.com/gravitl/netmaker/logic"
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -16,7 +15,7 @@ import (
|
|||||||
var dnsHost models.Host
|
var dnsHost models.Host
|
||||||
|
|
||||||
func TestGetAllDNS(t *testing.T) {
|
func TestGetAllDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -47,7 +46,7 @@ func TestGetAllDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetNodeDNS(t *testing.T) {
|
func TestGetNodeDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -94,7 +93,7 @@ func TestGetNodeDNS(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func TestGetCustomDNS(t *testing.T) {
|
func TestGetCustomDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
t.Run("NoNetworks", func(t *testing.T) {
|
t.Run("NoNetworks", func(t *testing.T) {
|
||||||
@@ -133,7 +132,7 @@ func TestGetCustomDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDNSEntryNum(t *testing.T) {
|
func TestGetDNSEntryNum(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -152,7 +151,7 @@ func TestGetDNSEntryNum(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func TestGetDNS(t *testing.T) {
|
func TestGetDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -196,7 +195,7 @@ func TestGetDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateDNS(t *testing.T) {
|
func TestCreateDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -207,7 +206,7 @@ func TestCreateDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSetDNS(t *testing.T) {
|
func TestSetDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
t.Run("NoNetworks", func(t *testing.T) {
|
t.Run("NoNetworks", func(t *testing.T) {
|
||||||
@@ -255,7 +254,7 @@ func TestSetDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDNSEntry(t *testing.T) {
|
func TestGetDNSEntry(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -285,7 +284,7 @@ func TestGetDNSEntry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteDNS(t *testing.T) {
|
func TestDeleteDNS(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -307,7 +306,7 @@ func TestDeleteDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateDNSUpdate(t *testing.T) {
|
func TestValidateDNSUpdate(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllDNS(t)
|
deleteAllDNS(t)
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
@@ -369,7 +368,7 @@ func TestValidateDNSUpdate(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
func TestValidateDNSCreate(t *testing.T) {
|
func TestValidateDNSCreate(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
_ = logic.DeleteDNS("mynode", "skynet")
|
_ = logic.DeleteDNS("mynode", "skynet")
|
||||||
t.Run("NoNetwork", func(t *testing.T) {
|
t.Run("NoNetwork", func(t *testing.T) {
|
||||||
entry := models.DNSEntry{"10.0.0.2", "", "myhost", "badnet"}
|
entry := models.DNSEntry{"10.0.0.2", "", "myhost", "badnet"}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -321,6 +322,7 @@ func deleteAllNetworks() {
|
|||||||
func initialize() {
|
func initialize() {
|
||||||
database.InitializeDatabase()
|
database.InitializeDatabase()
|
||||||
createAdminUser()
|
createAdminUser()
|
||||||
|
go logic.ManageZombies(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAdminUser() {
|
func createAdminUser() {
|
||||||
|
@@ -21,7 +21,7 @@ func TestCreateEgressGateway(t *testing.T) {
|
|||||||
var gateway models.EgressGatewayRequest
|
var gateway models.EgressGatewayRequest
|
||||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||||
gateway.NetID = "skynet"
|
gateway.NetID = "skynet"
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
t.Run("NoNodes", func(t *testing.T) {
|
t.Run("NoNodes", func(t *testing.T) {
|
||||||
@@ -78,7 +78,7 @@ func TestCreateEgressGateway(t *testing.T) {
|
|||||||
}
|
}
|
||||||
func TestDeleteEgressGateway(t *testing.T) {
|
func TestDeleteEgressGateway(t *testing.T) {
|
||||||
var gateway models.EgressGatewayRequest
|
var gateway models.EgressGatewayRequest
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
testnode := createTestNode()
|
testnode := createTestNode()
|
||||||
@@ -110,7 +110,7 @@ func TestDeleteEgressGateway(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetNetworkNodes(t *testing.T) {
|
func TestGetNetworkNodes(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
t.Run("BadNet", func(t *testing.T) {
|
t.Run("BadNet", func(t *testing.T) {
|
||||||
|
@@ -3,7 +3,6 @@ package controller
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gravitl/netmaker/database"
|
|
||||||
"github.com/gravitl/netmaker/logic"
|
"github.com/gravitl/netmaker/logic"
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@@ -18,7 +17,7 @@ func deleteAllUsers() {
|
|||||||
|
|
||||||
func TestHasAdmin(t *testing.T) {
|
func TestHasAdmin(t *testing.T) {
|
||||||
//delete all current users
|
//delete all current users
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
users, _ := logic.GetUsers()
|
users, _ := logic.GetUsers()
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
success, err := logic.DeleteUser(user.UserName)
|
success, err := logic.DeleteUser(user.UserName)
|
||||||
@@ -48,7 +47,7 @@ func TestHasAdmin(t *testing.T) {
|
|||||||
})
|
})
|
||||||
t.Run("multiple admins", func(t *testing.T) {
|
t.Run("multiple admins", func(t *testing.T) {
|
||||||
var user = models.User{"admin1", "password", nil, true, nil}
|
var user = models.User{"admin1", "password", nil, true, nil}
|
||||||
err := logic.CreateUser(&user)
|
err := logic.CreateUser(&user)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
found, err := logic.HasAdmin()
|
found, err := logic.HasAdmin()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
@@ -57,7 +56,7 @@ func TestHasAdmin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateUser(t *testing.T) {
|
func TestCreateUser(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
user := models.User{"admin", "password", nil, true, nil}
|
user := models.User{"admin", "password", nil, true, nil}
|
||||||
t.Run("NoUser", func(t *testing.T) {
|
t.Run("NoUser", func(t *testing.T) {
|
||||||
@@ -72,7 +71,7 @@ func TestCreateUser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateAdmin(t *testing.T) {
|
func TestCreateAdmin(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
var user models.User
|
var user models.User
|
||||||
t.Run("NoAdmin", func(t *testing.T) {
|
t.Run("NoAdmin", func(t *testing.T) {
|
||||||
@@ -90,7 +89,7 @@ func TestCreateAdmin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteUser(t *testing.T) {
|
func TestDeleteUser(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
t.Run("NonExistent User", func(t *testing.T) {
|
t.Run("NonExistent User", func(t *testing.T) {
|
||||||
deleted, err := logic.DeleteUser("admin")
|
deleted, err := logic.DeleteUser("admin")
|
||||||
@@ -107,7 +106,7 @@ func TestDeleteUser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateUser(t *testing.T) {
|
func TestValidateUser(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
var user models.User
|
var user models.User
|
||||||
t.Run("Valid Create", func(t *testing.T) {
|
t.Run("Valid Create", func(t *testing.T) {
|
||||||
user.UserName = "admin"
|
user.UserName = "admin"
|
||||||
@@ -155,7 +154,7 @@ func TestValidateUser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetUser(t *testing.T) {
|
func TestGetUser(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
t.Run("NonExistantUser", func(t *testing.T) {
|
t.Run("NonExistantUser", func(t *testing.T) {
|
||||||
admin, err := logic.GetUser("admin")
|
admin, err := logic.GetUser("admin")
|
||||||
@@ -172,7 +171,7 @@ func TestGetUser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetUsers(t *testing.T) {
|
func TestGetUsers(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
t.Run("NonExistantUser", func(t *testing.T) {
|
t.Run("NonExistantUser", func(t *testing.T) {
|
||||||
admin, err := logic.GetUsers()
|
admin, err := logic.GetUsers()
|
||||||
@@ -203,7 +202,7 @@ func TestGetUsers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateUser(t *testing.T) {
|
func TestUpdateUser(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
user := models.User{"admin", "password", nil, true, nil}
|
user := models.User{"admin", "password", nil, true, nil}
|
||||||
newuser := models.User{"hello", "world", []string{"wirecat, netmaker"}, true, []string{}}
|
newuser := models.User{"hello", "world", []string{"wirecat, netmaker"}, true, []string{}}
|
||||||
@@ -246,7 +245,7 @@ func TestUpdateUser(t *testing.T) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
func TestVerifyAuthRequest(t *testing.T) {
|
func TestVerifyAuthRequest(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
deleteAllUsers()
|
deleteAllUsers()
|
||||||
var authRequest models.UserAuthParams
|
var authRequest models.UserAuthParams
|
||||||
t.Run("EmptyUserName", func(t *testing.T) {
|
t.Run("EmptyUserName", func(t *testing.T) {
|
||||||
|
@@ -20,7 +20,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkExists(t *testing.T) {
|
func TestNetworkExists(t *testing.T) {
|
||||||
err := database.InitializeDatabase()
|
err := initialize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error initilizing database: %s", err)
|
t.Fatalf("error initilizing database: %s", err)
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ func TestNetworkExists(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAllExtClients(t *testing.T) {
|
func TestGetAllExtClients(t *testing.T) {
|
||||||
err := database.InitializeDatabase()
|
err := initialize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error initilizing database: %s", err)
|
t.Fatalf("error initilizing database: %s", err)
|
||||||
}
|
}
|
||||||
|
@@ -5,13 +5,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gravitl/netmaker/database"
|
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
"github.com/matryer/is"
|
"github.com/matryer/is"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCheckPorts(t *testing.T) {
|
func TestCheckPorts(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
h := models.Host{
|
h := models.Host{
|
||||||
ID: uuid.New(),
|
ID: uuid.New(),
|
||||||
EndpointIP: net.ParseIP("192.168.1.1"),
|
EndpointIP: net.ParseIP("192.168.1.1"),
|
||||||
|
@@ -91,7 +91,7 @@ func DeleteNode(node *models.Node, purge bool) error {
|
|||||||
if err := UpdateNode(node, &newnode); err != nil {
|
if err := UpdateNode(node, &newnode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
zombies = append(zombies, node.ID)
|
newZombie <- node.ID
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
host, err := GetHost(node.HostID.String())
|
host, err := GetHost(node.HostID.String())
|
||||||
|
@@ -4,14 +4,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gravitl/netmaker/database"
|
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
"github.com/gravitl/netmaker/models/promodels"
|
"github.com/gravitl/netmaker/models/promodels"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkUserLogic(t *testing.T) {
|
func TestNetworkUserLogic(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
networkUser := promodels.NetworkUser{
|
networkUser := promodels.NetworkUser{
|
||||||
ID: "helloworld",
|
ID: "helloworld",
|
||||||
}
|
}
|
||||||
|
@@ -3,13 +3,12 @@ package pro
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gravitl/netmaker/database"
|
|
||||||
"github.com/gravitl/netmaker/models/promodels"
|
"github.com/gravitl/netmaker/models/promodels"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserGroupLogic(t *testing.T) {
|
func TestUserGroupLogic(t *testing.T) {
|
||||||
database.InitializeDatabase()
|
initialize()
|
||||||
|
|
||||||
t.Run("User Groups initialized successfully", func(t *testing.T) {
|
t.Run("User Groups initialized successfully", func(t *testing.T) {
|
||||||
err := InitializeGroups()
|
err := InitializeGroups()
|
||||||
|
@@ -17,8 +17,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
zombies []uuid.UUID
|
zombies []uuid.UUID
|
||||||
hostZombies []uuid.UUID
|
hostZombies []uuid.UUID
|
||||||
|
newZombie chan uuid.UUID = make(chan (uuid.UUID), 10)
|
||||||
|
newHostZombie chan uuid.UUID = make(chan (uuid.UUID), 10)
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckZombies - checks if new node has same hostid as existing node
|
// CheckZombies - checks if new node has same hostid as existing node
|
||||||
@@ -37,7 +39,7 @@ func CheckZombies(newnode *models.Node) {
|
|||||||
}
|
}
|
||||||
if node.HostID == newnode.HostID || time.Now().After(node.ExpirationDateTime) {
|
if node.HostID == newnode.HostID || time.Now().After(node.ExpirationDateTime) {
|
||||||
logger.Log(0, "adding ", node.ID.String(), " to zombie list")
|
logger.Log(0, "adding ", node.ID.String(), " to zombie list")
|
||||||
zombies = append(zombies, node.ID)
|
newZombie <- node.ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +59,7 @@ func checkForZombieHosts(h *models.Host) {
|
|||||||
}
|
}
|
||||||
if existing.MacAddress.String() == h.MacAddress.String() {
|
if existing.MacAddress.String() == h.MacAddress.String() {
|
||||||
//add to hostZombies
|
//add to hostZombies
|
||||||
hostZombies = append(hostZombies, existing.ID)
|
newHostZombie <- existing.ID
|
||||||
//add all nodes belonging to host to zombile list
|
//add all nodes belonging to host to zombile list
|
||||||
for _, node := range existing.Nodes {
|
for _, node := range existing.Nodes {
|
||||||
id, err := uuid.Parse(node)
|
id, err := uuid.Parse(node)
|
||||||
@@ -65,7 +67,7 @@ func checkForZombieHosts(h *models.Host) {
|
|||||||
logger.Log(3, "error parsing uuid from host.Nodes", err.Error())
|
logger.Log(3, "error parsing uuid from host.Nodes", err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
zombies = append(zombies, id)
|
newHostZombie <- id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,6 +81,10 @@ func ManageZombies(ctx context.Context, peerUpdate chan *models.Node) {
|
|||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
|
case id := <-newZombie:
|
||||||
|
zombies = append(zombies, id)
|
||||||
|
case id := <-newHostZombie:
|
||||||
|
hostZombies = append(hostZombies, id)
|
||||||
case <-time.After(time.Second * ZOMBIE_TIMEOUT):
|
case <-time.After(time.Second * ZOMBIE_TIMEOUT):
|
||||||
logger.Log(3, "checking for zombie nodes")
|
logger.Log(3, "checking for zombie nodes")
|
||||||
if len(zombies) > 0 {
|
if len(zombies) > 0 {
|
||||||
@@ -142,10 +148,10 @@ func InitializeZombies() {
|
|||||||
}
|
}
|
||||||
if node.HostID == othernode.HostID {
|
if node.HostID == othernode.HostID {
|
||||||
if node.LastCheckIn.After(othernode.LastCheckIn) {
|
if node.LastCheckIn.After(othernode.LastCheckIn) {
|
||||||
zombies = append(zombies, othernode.ID)
|
newZombie <- othernode.ID
|
||||||
logger.Log(1, "adding", othernode.ID.String(), "to zombie list")
|
logger.Log(1, "adding", othernode.ID.String(), "to zombie list")
|
||||||
} else {
|
} else {
|
||||||
zombies = append(zombies, node.ID)
|
newZombie <- node.ID
|
||||||
logger.Log(1, "adding", node.ID.String(), "to zombie list")
|
logger.Log(1, "adding", node.ID.String(), "to zombie list")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ package models
|
|||||||
|
|
||||||
// moved from controllers need work
|
// moved from controllers need work
|
||||||
//func TestUpdateNetwork(t *testing.T) {
|
//func TestUpdateNetwork(t *testing.T) {
|
||||||
// database.InitializeDatabase()
|
// initialize()
|
||||||
// createNet()
|
// createNet()
|
||||||
// network := getNet()
|
// network := getNet()
|
||||||
// t.Run("NetID", func(t *testing.T) {
|
// t.Run("NetID", func(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user