Skip to content

Commit

Permalink
pass vlan metro in test
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Rangwala <[email protected]>
  • Loading branch information
aayushrangwala committed Jan 31, 2024
1 parent 1b2bab5 commit 8fcadd3
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/e2e/gateways/bgp-dynamic-neighbour/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestBgpDynamicNeighbors_Create(t *testing.T) {
projectName := "metal-cli-" + randomStr + "-gateways-create"

project := helper.CreateTestProject(t, projectName)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "da")
vrf := helper.CreateTestVrfs(t, project.GetId(), "test-vrf-"+randomStr, vlan.GetVxlan())
vrfIpRes := helper.CreateTestVrfIpRequest(t, project.GetId(), vrf.GetId())
gway := helper.CreateTestVrfGateway(t, project.GetId(), vrfIpRes.VrfIpReservation.GetId(), vlan.GetId())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestBgpDynamicNeighbors_Delete(t *testing.T) {
projectName := "metal-cli-" + randomStr + "-gateway-delete"

project := helper.CreateTestProject(t, projectName)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "da")
vrf := helper.CreateTestVrfs(t, project.GetId(), "test-vrf-"+randomStr, vlan.GetVxlan())
vrfIpRes := helper.CreateTestVrfIpRequest(t, project.GetId(), vrf.GetId())
gway := helper.CreateTestVrfGateway(t, project.GetId(), vrfIpRes.VrfIpReservation.GetId(), vlan.GetId())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/bgp-dynamic-neighbour/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBgpDynamicNeighbors_Get(t *testing.T) {
projectName := "metal-cli-" + randomStr + "-gateway-get"

project := helper.CreateTestProject(t, projectName)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "da")
vrf := helper.CreateTestVrfs(t, project.GetId(), "test-vrf-"+randomStr, vlan.GetVxlan())
vrfIpRes := helper.CreateTestVrfIpRequest(t, project.GetId(), vrf.GetId())
gway := helper.CreateTestVrfGateway(t, project.GetId(), vrfIpRes.VrfIpReservation.GetId(), vlan.GetId())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/bgp-dynamic-neighbour/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBgpDynamicNeighbors_List(t *testing.T) {
projectName := "metal-cli-" + randomStr + "-gateway-get"

project := helper.CreateTestProject(t, projectName)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "da")
vrf := helper.CreateTestVrfs(t, project.GetId(), "test-vrf-"+randomStr, vlan.GetVxlan())
vrfIpRes := helper.CreateTestVrfIpRequest(t, project.GetId(), vrf.GetId())
gway := helper.CreateTestVrfGateway(t, project.GetId(), vrfIpRes.VrfIpReservation.GetId(), vlan.GetId())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestGateways_Create(t *testing.T) {
rootClient := root.NewClient(helper.ConsumerToken, helper.URL, helper.Version)
projectName := "metal-cli-" + helper.GenerateRandomString(5) + "-gateways-create"
project := helper.CreateTestProject(t, projectName)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "sv")

tests := []struct {
name string
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestGateways_Delete(t *testing.T) {
projectName := "metal-cli-" + helper.GenerateRandomString(5) + "-gateway-delete"
project := helper.CreateTestProject(t, projectName)

vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "sv")

subnetSize := int32(8)
metalGateway := helper.CreateTestGateway(t, project.GetId(), vlan.GetId(), &subnetSize)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gateways/retrieve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestGateways_Retrieve(t *testing.T) {
projectName := "metal-cli-" + helper.GenerateRandomString(5) + "-gateway-get"
project := helper.CreateTestProject(t, projectName)

vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "sv")

subnetSize := int32(8)
metalGateway := helper.CreateTestGateway(t, project.GetId(), vlan.GetId(), &subnetSize)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/interconnections/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestInterconnections_Create(t *testing.T) {
randomString := helper.GenerateRandomString(5)

project := helper.CreateTestProject(t, "metal-cli-interconnections-create-"+randomString)
vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "sv")

apiClient := helper.TestClient()

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/ports/vlans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestPorts_VLANs(t *testing.T) {
return
}

vlan := helper.CreateTestVLAN(t, project.GetId())
vlan := helper.CreateTestVLAN(t, project.GetId(), "sv")
t.Cleanup(func() {
if err := helper.UnAssignPortVlan(t, port.GetId(), vlan.GetId()); err != nil {
t.Error(err)
Expand Down
6 changes: 4 additions & 2 deletions test/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ func CreateTestDevice(t *testing.T, projectId, name string) *metalv1.Device {
return device
}

func CreateTestVLAN(t *testing.T, projectId string) *metalv1.VirtualNetwork {
func CreateTestVLAN(t *testing.T, projectId, metro string) *metalv1.VirtualNetwork {
TestApiClient := TestClient()
t.Helper()

metro := "da"
if metro == "" {
metro = "sv"
}
vlanCreateInput := metalv1.VirtualNetworkCreateInput{
Metro: &metro,
}
Expand Down

0 comments on commit 8fcadd3

Please sign in to comment.