mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-30 08:54:25 +08:00
fix node tests
This commit is contained in:
parent
66faa18fb9
commit
3d1e4f6ba9
2 changed files with 0 additions and 17 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue