From 3d1e4f6ba95579622dc7b63c678338c0e07db236 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Mon, 6 Feb 2023 20:11:31 +0400 Subject: [PATCH] fix node tests --- controllers/node_test.go | 11 ----------- models/structs.go | 6 ------ 2 files changed, 17 deletions(-) diff --git a/controllers/node_test.go b/controllers/node_test.go index d5ffec7c..b16c3c9e 100644 --- a/controllers/node_test.go +++ b/controllers/node_test.go @@ -19,7 +19,6 @@ var linuxHost models.Host func TestCreateEgressGateway(t *testing.T) { var gateway models.EgressGatewayRequest - gateway.Interface = "eth0" gateway.Ranges = []string{"10.100.100.0/24"} gateway.NetID = "skynet" database.InitializeDatabase() @@ -63,7 +62,6 @@ func TestCreateEgressGateway(t *testing.T) { }) t.Run("Success", func(t *testing.T) { var gateway models.EgressGatewayRequest - gateway.Interface = "eth0" gateway.Ranges = []string{"10.100.100.0/24"} gateway.NetID = "skynet" deleteAllNodes() @@ -84,7 +82,6 @@ func TestDeleteEgressGateway(t *testing.T) { deleteAllNetworks() createNet() testnode := createTestNode() - gateway.Interface = "eth0" gateway.Ranges = []string{"10.100.100.0/24"} gateway.NetID = "skynet" gateway.NodeID = testnode.ID.String() @@ -138,19 +135,11 @@ func TestGetNetworkNodes(t *testing.T) { func TestValidateEgressGateway(t *testing.T) { var gateway models.EgressGatewayRequest t.Run("EmptyRange", func(t *testing.T) { - gateway.Interface = "eth0" gateway.Ranges = []string{} err := logic.ValidateEgressGateway(gateway) assert.EqualError(t, err, "IP Ranges Cannot Be Empty") }) - t.Run("EmptyInterface", func(t *testing.T) { - gateway.Interface = "" - err := logic.ValidateEgressGateway(gateway) - assert.NotNil(t, err) - assert.Equal(t, "interface cannot be empty", err.Error()) - }) t.Run("Success", func(t *testing.T) { - gateway.Interface = "eth0" gateway.Ranges = []string{"10.100.100.0/24"} err := logic.ValidateEgressGateway(gateway) assert.Nil(t, err) diff --git a/models/structs.go b/models/structs.go index 2e13abd3..e6d935dd 100644 --- a/models/structs.go +++ b/models/structs.go @@ -160,12 +160,6 @@ type EgressGatewayRequest struct { NetID string `json:"netid" bson:"netid"` NatEnabled string `json:"natenabled" bson:"natenabled"` Ranges []string `json:"ranges" bson:"ranges"` -<<<<<<< Updated upstream - Interface string `json:"interface" bson:"interface"` -======= - PostUp string `json:"postup" bson:"postup"` - PostDown string `json:"postdown" bson:"postdown"` ->>>>>>> Stashed changes } // RelayRequest - relay request struct