From 8fcadd301e1eb838b0d8528b28155fd9d1225a6d Mon Sep 17 00:00:00 2001 From: Ayush Rangwala Date: Thu, 1 Feb 2024 00:03:29 +0530 Subject: [PATCH] pass vlan metro in test Signed-off-by: Ayush Rangwala --- test/e2e/gateways/bgp-dynamic-neighbour/create_test.go | 2 +- test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go | 2 +- test/e2e/gateways/bgp-dynamic-neighbour/get_test.go | 2 +- test/e2e/gateways/bgp-dynamic-neighbour/list_test.go | 2 +- test/e2e/gateways/create_test.go | 2 +- test/e2e/gateways/delete_test.go | 2 +- test/e2e/gateways/retrieve_test.go | 2 +- test/e2e/interconnections/create_test.go | 2 +- test/e2e/ports/vlans_test.go | 2 +- test/helper/helper.go | 6 ++++-- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/e2e/gateways/bgp-dynamic-neighbour/create_test.go b/test/e2e/gateways/bgp-dynamic-neighbour/create_test.go index 44530a7b..87a8520e 100644 --- a/test/e2e/gateways/bgp-dynamic-neighbour/create_test.go +++ b/test/e2e/gateways/bgp-dynamic-neighbour/create_test.go @@ -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()) diff --git a/test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go b/test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go index d85c054a..4b1393d2 100644 --- a/test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go +++ b/test/e2e/gateways/bgp-dynamic-neighbour/delete_test.go @@ -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()) diff --git a/test/e2e/gateways/bgp-dynamic-neighbour/get_test.go b/test/e2e/gateways/bgp-dynamic-neighbour/get_test.go index bb9aac68..dfad27fe 100644 --- a/test/e2e/gateways/bgp-dynamic-neighbour/get_test.go +++ b/test/e2e/gateways/bgp-dynamic-neighbour/get_test.go @@ -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()) diff --git a/test/e2e/gateways/bgp-dynamic-neighbour/list_test.go b/test/e2e/gateways/bgp-dynamic-neighbour/list_test.go index 9def2c90..5e71d9e7 100644 --- a/test/e2e/gateways/bgp-dynamic-neighbour/list_test.go +++ b/test/e2e/gateways/bgp-dynamic-neighbour/list_test.go @@ -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()) diff --git a/test/e2e/gateways/create_test.go b/test/e2e/gateways/create_test.go index a02b2861..47f7f30b 100644 --- a/test/e2e/gateways/create_test.go +++ b/test/e2e/gateways/create_test.go @@ -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 diff --git a/test/e2e/gateways/delete_test.go b/test/e2e/gateways/delete_test.go index 330eb729..3d3e641f 100644 --- a/test/e2e/gateways/delete_test.go +++ b/test/e2e/gateways/delete_test.go @@ -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) diff --git a/test/e2e/gateways/retrieve_test.go b/test/e2e/gateways/retrieve_test.go index 715671bf..c9f8574d 100644 --- a/test/e2e/gateways/retrieve_test.go +++ b/test/e2e/gateways/retrieve_test.go @@ -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) diff --git a/test/e2e/interconnections/create_test.go b/test/e2e/interconnections/create_test.go index d7beb34a..659a19bb 100644 --- a/test/e2e/interconnections/create_test.go +++ b/test/e2e/interconnections/create_test.go @@ -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() diff --git a/test/e2e/ports/vlans_test.go b/test/e2e/ports/vlans_test.go index 66a2515e..3c1cfd8e 100644 --- a/test/e2e/ports/vlans_test.go +++ b/test/e2e/ports/vlans_test.go @@ -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) diff --git a/test/helper/helper.go b/test/helper/helper.go index 15e98e8c..1d7b4e84 100644 --- a/test/helper/helper.go +++ b/test/helper/helper.go @@ -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, }