fixing tests

This commit is contained in:
afeiszli 2022-02-05 15:33:57 -05:00
parent dd79186a81
commit bea7467210
2 changed files with 6 additions and 2 deletions

View file

@ -32,10 +32,12 @@ func TestCreateEgressGateway(t *testing.T) {
assert.EqualError(t, err, "freebsd is unsupported for egress gateways")
})
t.Run("Success", func(t *testing.T) {
deleteAllNodes()
testnode := createTestNode()
gateway.NodeID = testnode.ID
node, err := logic.CreateEgressGateway(gateway)
t.Log(node)
assert.Nil(t, err)
assert.Equal(t, "yes", node.IsEgressGateway)
assert.Equal(t, gateway.Ranges, node.EgressGatewayRanges)
@ -47,7 +49,6 @@ func TestDeleteEgressGateway(t *testing.T) {
database.InitializeDatabase()
deleteAllNetworks()
createNet()
createTestNode()
testnode := createTestNode()
gateway.Interface = "eth0"
gateway.Ranges = []string{"10.100.100.0/24"}

View file

@ -604,7 +604,10 @@ func isMacAddressUnique(macaddress string, networkName string) (bool, error) {
nodes, err := GetNetworkNodes(networkName)
if err != nil {
return database.IsEmptyRecord(err), err
if database.IsEmptyRecord(err) {
return true, nil
}
return false, err
}
for _, node := range nodes {