mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-03 02:14:24 +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) {
|
func TestCreateEgressGateway(t *testing.T) {
|
||||||
var gateway models.EgressGatewayRequest
|
var gateway models.EgressGatewayRequest
|
||||||
gateway.Interface = "eth0"
|
|
||||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||||
gateway.NetID = "skynet"
|
gateway.NetID = "skynet"
|
||||||
database.InitializeDatabase()
|
database.InitializeDatabase()
|
||||||
|
@ -63,7 +62,6 @@ func TestCreateEgressGateway(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run("Success", func(t *testing.T) {
|
t.Run("Success", func(t *testing.T) {
|
||||||
var gateway models.EgressGatewayRequest
|
var gateway models.EgressGatewayRequest
|
||||||
gateway.Interface = "eth0"
|
|
||||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||||
gateway.NetID = "skynet"
|
gateway.NetID = "skynet"
|
||||||
deleteAllNodes()
|
deleteAllNodes()
|
||||||
|
@ -84,7 +82,6 @@ func TestDeleteEgressGateway(t *testing.T) {
|
||||||
deleteAllNetworks()
|
deleteAllNetworks()
|
||||||
createNet()
|
createNet()
|
||||||
testnode := createTestNode()
|
testnode := createTestNode()
|
||||||
gateway.Interface = "eth0"
|
|
||||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||||
gateway.NetID = "skynet"
|
gateway.NetID = "skynet"
|
||||||
gateway.NodeID = testnode.ID.String()
|
gateway.NodeID = testnode.ID.String()
|
||||||
|
@ -138,19 +135,11 @@ func TestGetNetworkNodes(t *testing.T) {
|
||||||
func TestValidateEgressGateway(t *testing.T) {
|
func TestValidateEgressGateway(t *testing.T) {
|
||||||
var gateway models.EgressGatewayRequest
|
var gateway models.EgressGatewayRequest
|
||||||
t.Run("EmptyRange", func(t *testing.T) {
|
t.Run("EmptyRange", func(t *testing.T) {
|
||||||
gateway.Interface = "eth0"
|
|
||||||
gateway.Ranges = []string{}
|
gateway.Ranges = []string{}
|
||||||
err := logic.ValidateEgressGateway(gateway)
|
err := logic.ValidateEgressGateway(gateway)
|
||||||
assert.EqualError(t, err, "IP Ranges Cannot Be Empty")
|
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) {
|
t.Run("Success", func(t *testing.T) {
|
||||||
gateway.Interface = "eth0"
|
|
||||||
gateway.Ranges = []string{"10.100.100.0/24"}
|
gateway.Ranges = []string{"10.100.100.0/24"}
|
||||||
err := logic.ValidateEgressGateway(gateway)
|
err := logic.ValidateEgressGateway(gateway)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
|
@ -160,12 +160,6 @@ type EgressGatewayRequest struct {
|
||||||
NetID string `json:"netid" bson:"netid"`
|
NetID string `json:"netid" bson:"netid"`
|
||||||
NatEnabled string `json:"natenabled" bson:"natenabled"`
|
NatEnabled string `json:"natenabled" bson:"natenabled"`
|
||||||
Ranges []string `json:"ranges" bson:"ranges"`
|
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
|
// RelayRequest - relay request struct
|
||||||
|
|
Loading…
Add table
Reference in a new issue