Browse Source

fixing validation

afeiszli 4 years ago
parent
commit
4cf5aad2e7
2 changed files with 4 additions and 5 deletions
  1. 4 4
      controllers/nodeHttpController_test.go
  2. 0 1
      test/node_test.go

+ 4 - 4
controllers/nodeHttpController_test.go

@@ -34,7 +34,7 @@ func TestCheckIn(t *testing.T) {
 func TestCreateEgressGateway(t *testing.T) {
 func TestCreateEgressGateway(t *testing.T) {
 	var gateway models.EgressGatewayRequest
 	var gateway models.EgressGatewayRequest
 	gateway.Interface = "eth0"
 	gateway.Interface = "eth0"
-	gateway.Ranges = ["10.100.100.0/24"]
+	gateway.Ranges = []string{"10.100.100.0/24"}
 	deleteNet(t)
 	deleteNet(t)
 	createNet()
 	createNet()
 	t.Run("NoNodes", func(t *testing.T) {
 	t.Run("NoNodes", func(t *testing.T) {
@@ -62,14 +62,14 @@ func TestDeleteEgressGateway(t *testing.T) {
 	createTestNode(t)
 	createTestNode(t)
 	testnode := createTestNode(t)
 	testnode := createTestNode(t)
 	gateway.Interface = "eth0"
 	gateway.Interface = "eth0"
-	gateway.Ranges = ["10.100.100.0/24"]
+	gateway.Ranges = []string{"10.100.100.0/24"}
 	gateway.NetID = "skynet"
 	gateway.NetID = "skynet"
 	gateway.NodeID = testnode.MacAddress
 	gateway.NodeID = testnode.MacAddress
 	t.Run("Success", func(t *testing.T) {
 	t.Run("Success", func(t *testing.T) {
 		node, err := CreateEgressGateway(gateway)
 		node, err := CreateEgressGateway(gateway)
 		assert.Nil(t, err)
 		assert.Nil(t, err)
 		assert.Equal(t, true, node.IsEgressGateway)
 		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)
 		node, err = DeleteEgressGateway(gateway.NetID, gateway.NodeID)
 		assert.Nil(t, err)
 		assert.Nil(t, err)
 		assert.Equal(t, false, node.IsEgressGateway)
 		assert.Equal(t, false, node.IsEgressGateway)
@@ -177,7 +177,7 @@ func TestValidateEgressGateway(t *testing.T) {
 	})
 	})
 	t.Run("Success", func(t *testing.T) {
 	t.Run("Success", func(t *testing.T) {
 		gateway.Interface = "eth0"
 		gateway.Interface = "eth0"
-		gateway.Ranges = ["10.100.100.0/24"]
+		gateway.Ranges = []string{"10.100.100.0/24"}
 		err := ValidateEgressGateway(gateway)
 		err := ValidateEgressGateway(gateway)
 		assert.Nil(t, err)
 		assert.Nil(t, err)
 	})
 	})

+ 0 - 1
test/node_test.go

@@ -286,7 +286,6 @@ func TestCreateEgressGateway(t *testing.T) {
 		assert.True(t, message.IsEgressGateway)
 		assert.True(t, message.IsEgressGateway)
 		t.Log(err)
 		t.Log(err)
 	})
 	})
-	})
 	t.Run("BadInterface", func(t *testing.T) {
 	t.Run("BadInterface", func(t *testing.T) {
 		gateway.Ranges = []string{"0.0.0.0/0"}
 		gateway.Ranges = []string{"0.0.0.0/0"}
 		gateway.Interface = ""
 		gateway.Interface = ""