diff --git a/controllers/node_test.go b/controllers/node_test.go index f3475767..c4451541 100644 --- a/controllers/node_test.go +++ b/controllers/node_test.go @@ -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"} diff --git a/logic/nodes.go b/logic/nodes.go index d393c8ac..c4166425 100644 --- a/logic/nodes.go +++ b/logic/nodes.go @@ -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 {