mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-27 22:48:22 +08:00
fixing validation
This commit is contained in:
parent
b7257bc2ff
commit
4cf5aad2e7
2 changed files with 4 additions and 5 deletions
|
|
@ -34,7 +34,7 @@ func TestCheckIn(t *testing.T) {
|
|||
func TestCreateEgressGateway(t *testing.T) {
|
||||
var gateway models.EgressGatewayRequest
|
||||
gateway.Interface = "eth0"
|
||||
gateway.Ranges = ["10.100.100.0/24"]
|
||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||
deleteNet(t)
|
||||
createNet()
|
||||
t.Run("NoNodes", func(t *testing.T) {
|
||||
|
|
@ -62,14 +62,14 @@ func TestDeleteEgressGateway(t *testing.T) {
|
|||
createTestNode(t)
|
||||
testnode := createTestNode(t)
|
||||
gateway.Interface = "eth0"
|
||||
gateway.Ranges = ["10.100.100.0/24"]
|
||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||
gateway.NetID = "skynet"
|
||||
gateway.NodeID = testnode.MacAddress
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
node, err := CreateEgressGateway(gateway)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, true, node.IsEgressGateway)
|
||||
assert.Equal(t, ["10.100.100.0/24"], node.EgressGatewayRanges)
|
||||
assert.Equal(t, []string{"10.100.100.0/24"}, node.EgressGatewayRanges)
|
||||
node, err = DeleteEgressGateway(gateway.NetID, gateway.NodeID)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, false, node.IsEgressGateway)
|
||||
|
|
@ -177,7 +177,7 @@ func TestValidateEgressGateway(t *testing.T) {
|
|||
})
|
||||
t.Run("Success", func(t *testing.T) {
|
||||
gateway.Interface = "eth0"
|
||||
gateway.Ranges = ["10.100.100.0/24"]
|
||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||
err := ValidateEgressGateway(gateway)
|
||||
assert.Nil(t, err)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -286,7 +286,6 @@ func TestCreateEgressGateway(t *testing.T) {
|
|||
assert.True(t, message.IsEgressGateway)
|
||||
t.Log(err)
|
||||
})
|
||||
})
|
||||
t.Run("BadInterface", func(t *testing.T) {
|
||||
gateway.Ranges = []string{"0.0.0.0/0"}
|
||||
gateway.Interface = ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue