From ab04c8b776500ca92a22172e5024253b27a0d6e0 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Tue, 2 Apr 2024 08:08:36 -0400 Subject: [PATCH] Use shipyard framework By instead of ginkgo By This alows flexibility to format or omit the output. Related to https://github.com/submariner-io/subctl/issues/131 Signed-off-by: Tom Pantelis --- test/e2e/cluster/add_remove_cluster.go | 18 ++++---- test/e2e/compliance/fips.go | 6 +-- test/e2e/dataplane/gateway_status.go | 4 +- test/e2e/dataplane/tcp_gn_pod_connectivity.go | 2 +- test/e2e/framework/dataplane.go | 15 +++---- test/e2e/redundancy/gateway_failover.go | 43 ++++++++++--------- test/e2e/redundancy/leader_election.go | 10 ++--- test/e2e/redundancy/route_agent_restart.go | 12 +++--- test/external/dataplane/connectivity.go | 10 ++--- test/external/dataplane/gn_connectivity.go | 18 ++++---- 10 files changed, 69 insertions(+), 69 deletions(-) diff --git a/test/e2e/cluster/add_remove_cluster.go b/test/e2e/cluster/add_remove_cluster.go index d74803780..b10fb4d40 100644 --- a/test/e2e/cluster/add_remove_cluster.go +++ b/test/e2e/cluster/add_remove_cluster.go @@ -36,11 +36,11 @@ var _ = PDescribe("[expansion] Test expanding/shrinking an existing cluster flee clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] clusterCName := framework.TestContext.ClusterIDs[framework.ClusterC] - By(fmt.Sprintf("Verifying no GW nodes are present on cluster %q", clusterCName)) + framework.By(fmt.Sprintf("Verifying no GW nodes are present on cluster %q", clusterCName)) gatewayNode := framework.FindGatewayNodes(framework.ClusterC) Expect(gatewayNode).To(BeEmpty(), fmt.Sprintf("Expected no gateway node on %q", framework.ClusterC)) - By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a pod in cluster %q", clusterAName, clusterCName)) + framework.By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a pod in cluster %q", clusterAName, clusterCName)) tcp.RunNoConnectivityTest(tcp.ConnectivityTestParams{ Framework: f, FromCluster: framework.ClusterA, @@ -49,7 +49,7 @@ var _ = PDescribe("[expansion] Test expanding/shrinking an existing cluster flee ToClusterScheduling: framework.NonGatewayNode, }) - By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a service in cluster %q", clusterBName, clusterCName)) + framework.By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a service in cluster %q", clusterBName, clusterCName)) tcp.RunNoConnectivityTest(tcp.ConnectivityTestParams{ Framework: f, ToEndpointType: tcp.ServiceIP, @@ -62,13 +62,13 @@ var _ = PDescribe("[expansion] Test expanding/shrinking an existing cluster flee nonGatewayNodes := framework.FindNonGatewayNodes(framework.ClusterC) Expect(nonGatewayNodes).ToNot(BeEmpty(), fmt.Sprintf("No non-gateway nodes found on %q", clusterCName)) nonGatewayNode := nonGatewayNodes[0].Name - By(fmt.Sprintf("Adding cluster %q by setting the gateway label on node %q", clusterCName, nonGatewayNode)) + framework.By(fmt.Sprintf("Adding cluster %q by setting the gateway label on node %q", clusterCName, nonGatewayNode)) f.SetGatewayLabelOnNode(context.TODO(), framework.ClusterC, nonGatewayNode, true) gatewayPod := f.AwaitSubmarinerGatewayPod(framework.ClusterC) - By(fmt.Sprintf("Found submariner gateway pod %q on %q", gatewayPod.Name, clusterCName)) + framework.By(fmt.Sprintf("Found submariner gateway pod %q on %q", gatewayPod.Name, clusterCName)) - By("Checking connectivity between clusters") + framework.By("Checking connectivity between clusters") tcp.RunConnectivityTest(tcp.ConnectivityTestParams{ Framework: f, FromCluster: framework.ClusterB, @@ -86,12 +86,12 @@ var _ = PDescribe("[expansion] Test expanding/shrinking an existing cluster flee ToClusterScheduling: framework.NonGatewayNode, }) - By(fmt.Sprintf("Removing cluster %q by unsetting the gateway label and deleting submariner gateway pod %q", + framework.By(fmt.Sprintf("Removing cluster %q by unsetting the gateway label and deleting submariner gateway pod %q", clusterCName, gatewayPod.Name)) f.SetGatewayLabelOnNode(context.TODO(), framework.ClusterC, nonGatewayNode, false) f.DeletePod(framework.ClusterC, gatewayPod.Name, framework.TestContext.SubmarinerNamespace) - By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a service in cluster %q", clusterAName, clusterCName)) + framework.By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a service in cluster %q", clusterAName, clusterCName)) tcp.RunNoConnectivityTest(tcp.ConnectivityTestParams{ Framework: f, FromCluster: framework.ClusterA, @@ -100,7 +100,7 @@ var _ = PDescribe("[expansion] Test expanding/shrinking an existing cluster flee ToClusterScheduling: framework.NonGatewayNode, }) - By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a pod in cluster %q", clusterBName, clusterCName)) + framework.By(fmt.Sprintf("Verifying that a pod in cluster %q cannot connect to a pod in cluster %q", clusterBName, clusterCName)) tcp.RunNoConnectivityTest(tcp.ConnectivityTestParams{ Framework: f, ToEndpointType: tcp.ServiceIP, diff --git a/test/e2e/compliance/fips.go b/test/e2e/compliance/fips.go index e97fe430c..b43f351e2 100644 --- a/test/e2e/compliance/fips.go +++ b/test/e2e/compliance/fips.go @@ -40,7 +40,7 @@ var _ = Describe("FIPS", Label(TestLabel), func() { }) func testFIPSGatewayStatus(f *subFramework.Framework) { - By(fmt.Sprintln("Find a cluster with FIPS enabled")) + framework.By(fmt.Sprintln("Find a cluster with FIPS enabled")) fipsCluster := f.FindFIPSEnabledCluster() @@ -49,7 +49,7 @@ func testFIPSGatewayStatus(f *subFramework.Framework) { } fipsClusterName := framework.TestContext.ClusterIDs[fipsCluster] - By(fmt.Sprintf("Found enabled FIPS on cluster %q", fipsClusterName)) + framework.By(fmt.Sprintf("Found enabled FIPS on cluster %q", fipsClusterName)) submEndpoint := f.AwaitSubmarinerEndpoint(fipsCluster, subFramework.NoopCheckEndpoint) @@ -57,7 +57,7 @@ func testFIPSGatewayStatus(f *subFramework.Framework) { framework.Skipf(fmt.Sprintf("Cluster %q is not using the libreswan cable driver, skipping the test...", fipsClusterName)) } - By(fmt.Sprintf("Locate active gateway pod on cluster %q", fipsClusterName)) + framework.By(fmt.Sprintf("Locate active gateway pod on cluster %q", fipsClusterName)) gwPod := f.AwaitActiveGatewayPod(fipsCluster, nil) Expect(gwPod).ToNot(BeNil(), "Did not find an active gateway pod") diff --git a/test/e2e/dataplane/gateway_status.go b/test/e2e/dataplane/gateway_status.go index 0159f2d87..6efd2e5e1 100644 --- a/test/e2e/dataplane/gateway_status.go +++ b/test/e2e/dataplane/gateway_status.go @@ -38,7 +38,7 @@ var _ = Describe("Gateway status reporting", Label(TestLabel), func() { It("should correctly report its status and connection information", func() { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] - By(fmt.Sprintf("Ensuring that only one gateway reports as active on %q", clusterAName)) + framework.By(fmt.Sprintf("Ensuring that only one gateway reports as active on %q", clusterAName)) activeGateways := f.AwaitGatewaysWithStatus(framework.ClusterA, submarinerv1.HAStatusActive) Expect(activeGateways).To(HaveLen(1)) @@ -46,7 +46,7 @@ var _ = Describe("Gateway status reporting", Label(TestLabel), func() { name := activeGateways[0].Name otherCluster := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Ensuring that gateway %q reports connection information for cluster %q", name, otherCluster)) + framework.By(fmt.Sprintf("Ensuring that gateway %q reports connection information for cluster %q", name, otherCluster)) gwClient := subFramework.SubmarinerClients[framework.ClusterA].SubmarinerV1().Gateways( framework.TestContext.SubmarinerNamespace) diff --git a/test/e2e/dataplane/tcp_gn_pod_connectivity.go b/test/e2e/dataplane/tcp_gn_pod_connectivity.go index b559620eb..def5f2776 100644 --- a/test/e2e/dataplane/tcp_gn_pod_connectivity.go +++ b/test/e2e/dataplane/tcp_gn_pod_connectivity.go @@ -94,7 +94,7 @@ var _ = Describe("Basic TCP connectivity tests across overlapping clusters witho lpConfig.Port++ cpConfig.Port = lpConfig.Port - By(fmt.Sprintf("Updating service port to %d", lpConfig.Port)) + framework.By(fmt.Sprintf("Updating service port to %d", lpConfig.Port)) err := util.Update(context.Background(), resource.ForService(framework.KubeClients[lpConfig.Cluster], f.Namespace), service, func(existing *v1.Service) (*v1.Service, error) { diff --git a/test/e2e/framework/dataplane.go b/test/e2e/framework/dataplane.go index 7d828771b..eb18de17c 100644 --- a/test/e2e/framework/dataplane.go +++ b/test/e2e/framework/dataplane.go @@ -23,7 +23,6 @@ import ( "fmt" "strconv" - . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" resourceUtil "github.com/submariner-io/admiral/pkg/resource" "github.com/submariner-io/shipyard/test/e2e/framework" @@ -115,7 +114,7 @@ func verifyGlobalnetDatapathConnectivity(p tcp.ConnectivityTestParams, gn Global Expect(connectorPodGlobalIPs).ToNot(BeEmpty()) - By(fmt.Sprintf("Creating a listener pod in cluster %q, which will wait for a handshake over TCP", + framework.By(fmt.Sprintf("Creating a listener pod in cluster %q, which will wait for a handshake over TCP", framework.TestContext.ClusterIDs[p.ToCluster])) listenerPodConfig := &framework.NetworkPodConfig{ @@ -128,7 +127,7 @@ func verifyGlobalnetDatapathConnectivity(p tcp.ConnectivityTestParams, gn Global listenerPod := p.Framework.NewNetworkPod(listenerPodConfig) - By(fmt.Sprintf("Pointing a ClusterIP service to the listener pod in cluster %q", + framework.By(fmt.Sprintf("Pointing a ClusterIP service to the listener pod in cluster %q", framework.TestContext.ClusterIDs[p.ToCluster])) var service *v1.Service @@ -144,7 +143,7 @@ func verifyGlobalnetDatapathConnectivity(p tcp.ConnectivityTestParams, gn Global remoteIP := getGlobalIngressIP(p, service) Expect(remoteIP).ToNot(Equal("")) - By(fmt.Sprintf("Creating a connector pod in cluster %q, which will attempt the specific UUID handshake over TCP", + framework.By(fmt.Sprintf("Creating a connector pod in cluster %q, which will attempt the specific UUID handshake over TCP", framework.TestContext.ClusterIDs[p.FromCluster])) connectorPodConfig := &framework.NetworkPodConfig{ @@ -177,19 +176,19 @@ func verifyGlobalnetDatapathConnectivity(p tcp.ConnectivityTestParams, gn Global }, connector.Config.Cluster) Expect(err).ToNot(HaveOccurred()) - By(fmt.Sprintf("Connector pod is scheduled on node %q", connector.Pod.Spec.NodeName)) + framework.By(fmt.Sprintf("Connector pod is scheduled on node %q", connector.Pod.Spec.NodeName)) - By(fmt.Sprintf("Waiting for the listener pod %q on node %q to exit, returning what listener sent", + framework.By(fmt.Sprintf("Waiting for the listener pod %q on node %q to exit, returning what listener sent", listener.Pod.Name, listener.Pod.Spec.NodeName)) listener.AwaitFinish() listener.CheckSuccessfulFinish() p.Framework.DeletePod(p.FromCluster, connector.Pod.Name, connector.Pod.Namespace) - By("Verifying that the listener got the connector's data and the connector got the listener's data") + framework.By("Verifying that the listener got the connector's data and the connector got the listener's data") Expect(listener.TerminationMessage).To(ContainSubstring(connector.Config.Data)) Expect(stdOut).To(ContainSubstring(listener.Config.Data)) - By(fmt.Sprintf("Verifying the output of the listener pod contains a %s global IP %v of the connector Pod", + framework.By(fmt.Sprintf("Verifying the output of the listener pod contains a %s global IP %v of the connector Pod", gn.GlobalEgressIP, connectorPodGlobalIPs)) matchIP := ContainSubstring(connectorPodGlobalIPs[0]) diff --git a/test/e2e/redundancy/gateway_failover.go b/test/e2e/redundancy/gateway_failover.go index 4f18306bb..a91fa1db5 100644 --- a/test/e2e/redundancy/gateway_failover.go +++ b/test/e2e/redundancy/gateway_failover.go @@ -60,7 +60,7 @@ var _ = Describe("Gateway fail-over tests", Label(TestLabel), func() { }) func testGatewayPodRestartScenario(f *subFramework.Framework) { - By(fmt.Sprintln("Sanity check - find a cluster with only one gateway node")) + framework.By(fmt.Sprintln("Sanity check - find a cluster with only one gateway node")) primaryCluster := subFramework.FindClusterWithSingleGateway() if primaryCluster == -1 { @@ -72,33 +72,34 @@ func testGatewayPodRestartScenario(f *subFramework.Framework) { primaryClusterName := framework.TestContext.ClusterIDs[primaryCluster] secondaryClusterName := framework.TestContext.ClusterIDs[secondaryCluster] - By(fmt.Sprintf("Detected primary cluster %q with single gateway node", primaryClusterName)) - By(fmt.Sprintf("Detected secondary cluster %q", secondaryClusterName)) + framework.By(fmt.Sprintf("Detected primary cluster %q with single gateway node", primaryClusterName)) + framework.By(fmt.Sprintf("Detected secondary cluster %q", secondaryClusterName)) gatewayNodes := framework.FindGatewayNodes(primaryCluster) Expect(gatewayNodes).To(HaveLen(1), fmt.Sprintf("Expected only one gateway node on %q", primaryClusterName)) - By(fmt.Sprintf("Found gateway on node %q on %q", gatewayNodes[0].Name, primaryClusterName)) + framework.By(fmt.Sprintf("Found gateway on node %q on %q", gatewayNodes[0].Name, primaryClusterName)) gatewayPod := f.AwaitSubmarinerGatewayPod(primaryCluster) - By(fmt.Sprintf("Found submariner gateway pod %q on %q, checking node and HA status labels", gatewayPod.Name, primaryClusterName)) + framework.By(fmt.Sprintf("Found submariner gateway pod %q on %q, checking node and HA status labels", gatewayPod.Name, primaryClusterName)) Expect(gatewayPod.Labels[gatewayStatusLabel]).To(Equal(gatewayStatusActive)) Expect(gatewayPod.Labels[gatewayNodeLabel]).To(Equal(gatewayNodes[0].Name)) - By(fmt.Sprintf("Ensuring that the gateway reports as active on %q", primaryClusterName)) + framework.By(fmt.Sprintf("Ensuring that the gateway reports as active on %q", primaryClusterName)) activeGateway := f.AwaitGatewayFullyConnected(primaryCluster, resource.EnsureValidName(gatewayNodes[0].Name)) - By(fmt.Sprintf("Deleting submariner gateway pod %q", gatewayPod.Name)) + framework.By(fmt.Sprintf("Deleting submariner gateway pod %q", gatewayPod.Name)) f.DeletePod(primaryCluster, gatewayPod.Name, framework.TestContext.SubmarinerNamespace) newGatewayPod := AwaitNewSubmarinerGatewayPod(f, primaryCluster, gatewayPod.ObjectMeta.UID) - By(fmt.Sprintf("Found new submariner gateway pod %q", newGatewayPod.Name)) + framework.By(fmt.Sprintf("Found new submariner gateway pod %q", newGatewayPod.Name)) - By(fmt.Sprintf("Waiting for the gateway to be up and connected %q", newGatewayPod.Name)) + framework.By(fmt.Sprintf("Waiting for the gateway to be up and connected %q", newGatewayPod.Name)) AwaitNewSubmarinerGatewayFullyConnected(f, primaryCluster, activeGateway.Name, activeGateway.UID) - By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", secondaryClusterName, primaryClusterName)) + framework.By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", secondaryClusterName, + primaryClusterName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, FromCluster: secondaryCluster, @@ -113,7 +114,7 @@ func testGatewayPodRestartScenario(f *subFramework.Framework) { return } - By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", + framework.By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", secondaryClusterName, primaryClusterName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, @@ -175,19 +176,19 @@ func testGatewayFailOverScenario(f *subFramework.Framework) { clusterAName := framework.TestContext.ClusterIDs[primaryCluster] clusterBName := framework.TestContext.ClusterIDs[secondaryCluster] - By(fmt.Sprintf("Found two gateway nodes on %q", clusterAName)) + framework.By(fmt.Sprintf("Found two gateway nodes on %q", clusterAName)) initialGWPod := f.AwaitActiveGatewayPod(framework.ClusterIndex(primaryCluster), nil) Expect(initialGWPod).ToNot(BeNil(), "Did not find an active gateway pod") - By(fmt.Sprintf("Ensure active gateway node %q has established connections", initialGWPod.Name)) + framework.By(fmt.Sprintf("Ensure active gateway node %q has established connections", initialGWPod.Name)) gwConnection := f.AwaitGatewayWithStatus(framework.ClusterIndex(primaryCluster), initialGWPod.Spec.NodeName, subv1.HAStatusActive) Expect(gwConnection.Status.Connections).NotTo(BeEmpty(), "The active gateway must have established connections") submEndpoint := f.AwaitSubmarinerEndpoint(framework.ClusterIndex(primaryCluster), subFramework.NoopCheckEndpoint) - By(fmt.Sprintf("Found submariner endpoint for %q: %#v", clusterAName, submEndpoint)) + framework.By(fmt.Sprintf("Found submariner endpoint for %q: %#v", clusterAName, submEndpoint)) - By("Performing fail-over to passive gateway") + framework.By("Performing fail-over to passive gateway") f.DoFailover(context.TODO(), framework.ClusterIndex(primaryCluster), initialGWPod.Spec.NodeName, initialGWPod.Name) newGWPod := f.AwaitActiveGatewayPod(framework.ClusterIndex(primaryCluster), func(pod *v1.Pod) bool { @@ -195,20 +196,20 @@ func testGatewayFailOverScenario(f *subFramework.Framework) { }) Expect(newGWPod).ToNot(BeNil(), "Did not find a new active gateway pod running on a different node") - By(fmt.Sprintf("Found new submariner gateway pod %q", newGWPod.Name)) + framework.By(fmt.Sprintf("Found new submariner gateway pod %q", newGWPod.Name)) - By(fmt.Sprintf("Waiting for the new pod %q to report as fully connected", newGWPod.Name)) + framework.By(fmt.Sprintf("Waiting for the new pod %q to report as fully connected", newGWPod.Name)) f.AwaitGatewayFullyConnected(framework.ClusterIndex(primaryCluster), resource.EnsureValidName(newGWPod.Spec.NodeName)) // Verify a new Endpoint instance is created by the new gateway instance. This is a bit whitebox but it's a sanity check // and also gives it a bit more of a cushion to avoid premature timeout in the connectivity test. newSubmEndpoint := f.AwaitNewSubmarinerEndpoint(framework.ClusterIndex(primaryCluster), submEndpoint.ObjectMeta.UID) - By(fmt.Sprintf("Found new submariner endpoint for %q: %#v", clusterAName, newSubmEndpoint)) + framework.By(fmt.Sprintf("Found new submariner endpoint for %q: %#v", clusterAName, newSubmEndpoint)) - By(fmt.Sprintf("Waiting for the previous submariner endpoint %q to be removed on %q", newGWPod.Name, clusterBName)) + framework.By(fmt.Sprintf("Waiting for the previous submariner endpoint %q to be removed on %q", newGWPod.Name, clusterBName)) f.AwaitSubmarinerEndpointRemoved(framework.ClusterIndex(secondaryCluster), submEndpoint.Name) - By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", clusterBName, clusterAName)) + framework.By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", clusterBName, clusterAName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, FromCluster: framework.ClusterIndex(secondaryCluster), @@ -223,7 +224,7 @@ func testGatewayFailOverScenario(f *subFramework.Framework) { return } - By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", clusterBName, clusterAName)) + framework.By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", clusterBName, clusterAName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, FromCluster: framework.ClusterIndex(secondaryCluster), diff --git a/test/e2e/redundancy/leader_election.go b/test/e2e/redundancy/leader_election.go index eb22e30cf..13217ada6 100644 --- a/test/e2e/redundancy/leader_election.go +++ b/test/e2e/redundancy/leader_election.go @@ -55,9 +55,9 @@ var _ = Describe("Leader election tests", func() { gateway := f.AwaitGatewayWithStatus(cluster, gatewayPod.Spec.NodeName, subv1.HAStatusActive) - By(fmt.Sprintf("Found submariner Gateway %q on cluster %q", gateway.Name, clusterName)) + framework.By(fmt.Sprintf("Found submariner Gateway %q on cluster %q", gateway.Name, clusterName)) - By("Updating submariner-gateway Role to remove Lease update permission") + framework.By("Updating submariner-gateway Role to remove Lease update permission") updateLeaseUpdatePermission(cluster, gateway.Namespace, slices.Remove[string, string]) @@ -65,7 +65,7 @@ var _ = Describe("Leader election tests", func() { updateLeaseUpdatePermission(cluster, gateway.Namespace, slices.AppendIfNotPresent[string, string]) }) - By(fmt.Sprintf("Ensure Gateway %q is updated to passive", gateway.Name)) + framework.By(fmt.Sprintf("Ensure Gateway %q is updated to passive", gateway.Name)) f.AwaitGatewaysWithStatus(cluster, subv1.HAStatusPassive) @@ -79,11 +79,11 @@ var _ = Describe("Leader election tests", func() { Networking: framework.PodNetworking, }, subFramework.GetGlobalnetEgressParams(subFramework.ClusterSelector)) - By("Updating submariner-gateway Role to add Lease update permission") + framework.By("Updating submariner-gateway Role to add Lease update permission") updateLeaseUpdatePermission(cluster, gateway.Namespace, slices.AppendIfNotPresent[string, string]) - By(fmt.Sprintf("Ensure Gateway %q is updated to active", gateway.Name)) + framework.By(fmt.Sprintf("Ensure Gateway %q is updated to active", gateway.Name)) f.AwaitGatewayWithStatus(cluster, gatewayPod.Spec.NodeName, subv1.HAStatusActive) diff --git a/test/e2e/redundancy/route_agent_restart.go b/test/e2e/redundancy/route_agent_restart.go index 2595c5d0f..a7833a0cc 100644 --- a/test/e2e/redundancy/route_agent_restart.go +++ b/test/e2e/redundancy/route_agent_restart.go @@ -60,19 +60,19 @@ func testRouteAgentRestart(f *subFramework.Framework, onGateway bool) { return } - By(fmt.Sprintf("Found node %q on %q", nodes[0].Name, clusterAName)) + framework.By(fmt.Sprintf("Found node %q on %q", nodes[0].Name, clusterAName)) node := nodes[0] routeAgentPod := f.AwaitRouteAgentPodOnNode(framework.ClusterA, node.Name, "") - By(fmt.Sprintf("Found route agent pod %q on node %q", routeAgentPod.Name, node.Name)) + framework.By(fmt.Sprintf("Found route agent pod %q on node %q", routeAgentPod.Name, node.Name)) - By(fmt.Sprintf("Deleting route agent pod %q", routeAgentPod.Name)) + framework.By(fmt.Sprintf("Deleting route agent pod %q", routeAgentPod.Name)) f.DeletePod(framework.ClusterA, routeAgentPod.Name, framework.TestContext.SubmarinerNamespace) newRouteAgentPod := f.AwaitRouteAgentPodOnNode(framework.ClusterA, node.Name, routeAgentPod.UID) - By(fmt.Sprintf("Found new route agent pod %q on node %q", newRouteAgentPod.Name, node.Name)) + framework.By(fmt.Sprintf("Found new route agent pod %q on node %q", newRouteAgentPod.Name, node.Name)) - By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", clusterBName, clusterAName)) + framework.By(fmt.Sprintf("Verifying TCP connectivity from gateway node on %q to gateway node on %q", clusterBName, clusterAName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, FromCluster: framework.ClusterB, @@ -82,7 +82,7 @@ func testRouteAgentRestart(f *subFramework.Framework, onGateway bool) { ToEndpointType: defaultEndpointType(), }, subFramework.GetGlobalnetEgressParams(subFramework.ClusterSelector)) - By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", clusterBName, clusterAName)) + framework.By(fmt.Sprintf("Verifying TCP connectivity from non-gateway node on %q to non-gateway node on %q", clusterBName, clusterAName)) subFramework.VerifyDatapathConnectivity(tcp.ConnectivityTestParams{ Framework: f.Framework, FromCluster: framework.ClusterB, diff --git a/test/external/dataplane/connectivity.go b/test/external/dataplane/connectivity.go index 59c4b2899..9923e5961 100644 --- a/test/external/dataplane/connectivity.go +++ b/test/external/dataplane/connectivity.go @@ -195,7 +195,7 @@ func testExternalConnectivity(p testParams) { clusterName := framework.TestContext.ClusterIDs[p.Cluster] - By(fmt.Sprintf("Creating a pod and a service in cluster %q", clusterName)) + framework.By(fmt.Sprintf("Creating a pod and a service in cluster %q", clusterName)) np := p.Framework.NewNetworkPod(&framework.NetworkPodConfig{ Type: framework.CustomPod, @@ -230,13 +230,13 @@ func testExternalConnectivity(p testParams) { targetIP = svcIP } - By(fmt.Sprintf("Sending an http request from external app %q to %q in the cluster %q", + framework.By(fmt.Sprintf("Sending an http request from external app %q to %q in the cluster %q", dockerIP, targetIP, clusterName)) command := []string{"curl", "-m", "3", fmt.Sprintf("%s:%d/%s%s", targetIP, framework.TestPort, p.Framework.Namespace, clusterName)} _, _ = docker.RunCommandUntil(command...) - By("Verifying the pod received the request") + framework.By("Verifying the pod received the request") podLog := np.GetLog() @@ -246,13 +246,13 @@ func testExternalConnectivity(p testParams) { Expect(podLog).To(MatchRegexp("%s .*GET /%s%s .*", dockerIP, p.Framework.Namespace, clusterName)) } - By(fmt.Sprintf("Sending an http request from the test pod %q %q in cluster %q to the external app %q", + framework.By(fmt.Sprintf("Sending an http request from the test pod %q %q in cluster %q to the external app %q", np.Pod.Name, podIP, clusterName, dockerIP)) cmd := []string{"curl", "-m", "10", fmt.Sprintf("%s:%d/%s%s", dockerIP, framework.TestPort, p.Framework.Namespace, clusterName)} _, _ = np.RunCommand(context.TODO(), cmd) - By("Verifying that external app received request") + framework.By("Verifying that external app received request") // Only check stderr _, dockerLog := docker.GetLog() diff --git a/test/external/dataplane/gn_connectivity.go b/test/external/dataplane/gn_connectivity.go index 0701dfab2..4f5dc2825 100644 --- a/test/external/dataplane/gn_connectivity.go +++ b/test/external/dataplane/gn_connectivity.go @@ -292,7 +292,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { extClusterIdx, err := getGatewayClusterIndex(framework.TestContext.ClusterIDs) Expect(err).NotTo(HaveOccurred()) - By(fmt.Sprintf("Creating a service without selector and endpoints in cluster %q", gatewayCluster)) + framework.By(fmt.Sprintf("Creating a service without selector and endpoints in cluster %q", gatewayCluster)) // Get handle for existing docker docker := framework.New(extAppName) dockerIP := docker.GetIP(extNetName) @@ -320,7 +320,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { clusterName := framework.TestContext.ClusterIDs[p.Cluster] - By(fmt.Sprintf("Creating a pod and a service in cluster %q", clusterName)) + framework.By(fmt.Sprintf("Creating a pod and a service in cluster %q", clusterName)) np := p.Framework.NewNetworkPod(&framework.NetworkPodConfig{ Type: framework.CustomPod, @@ -342,7 +342,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { podGlobalIPs := getPodGlobalIPs(p, g, np) Expect(podGlobalIPs).ToNot(BeEmpty()) - By(fmt.Sprintf("Sending an http request from external app %q to the service %q in the cluster %q", + framework.By(fmt.Sprintf("Sending an http request from external app %q to the service %q in the cluster %q", dockerIP, remoteIP, clusterName)) command := []string{"curl", "-m", "10", fmt.Sprintf("%s:%d/%s%s", remoteIP, framework.TestPort, p.Framework.Namespace, clusterName)} @@ -353,12 +353,12 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { if p.Cluster == extClusterIdx { // TODO: current behavior is that source IP from external app to the pod in the cluster that directly connected to // external network is the gateway IP of the pod network. Consider if it can be consistent. - By("Verifying the pod received the request from any IP") + framework.By("Verifying the pod received the request from any IP") Expect(podLog).To(MatchRegexp(".*GET /%s%s .*", p.Framework.Namespace, clusterName)) } else { switch g.ExtEndpointType { case ClusterIP: - By(fmt.Sprintf("Verifying the pod received the request from one of egressGlobalIPs %v", extEgressGlobalIPs)) + framework.By(fmt.Sprintf("Verifying the pod received the request from one of egressGlobalIPs %v", extEgressGlobalIPs)) matchRegexp := MatchRegexp("%s .*GET /%s%s .*", extEgressGlobalIPs[0], p.Framework.Namespace, clusterName) for i := 1; i < len(extEgressGlobalIPs); i++ { @@ -367,7 +367,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { Expect(podLog).To(matchRegexp) case Headless: // For access from headless service, source IP is the globalIngressIP of the external app - By(fmt.Sprintf("Verifying the pod received the request from globalIngressIP of the external app %v", extIngressGlobalIP)) + framework.By(fmt.Sprintf("Verifying the pod received the request from globalIngressIP of the external app %v", extIngressGlobalIP)) Expect(podLog).To(MatchRegexp("%s .*GET /%s%s .*", extIngressGlobalIP, p.Framework.Namespace, clusterName)) } } @@ -380,7 +380,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { return } - By(fmt.Sprintf("Sending an http request from the test pod %q in cluster %q to the external app's ingressGlobalIP %q", + framework.By(fmt.Sprintf("Sending an http request from the test pod %q in cluster %q to the external app's ingressGlobalIP %q", np.Pod.Name, clusterName, extIngressGlobalIP)) cmd := []string{"curl", "-m", "10", fmt.Sprintf("%s:%d/%s%s", extIngressGlobalIP, framework.TestPort, p.Framework.Namespace, clusterName)} @@ -393,7 +393,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { case tcp.PodIP, tcp.ServiceIP: framework.Failf("Unsupported ToEndpointType %v was passed", p.ToEndpointType) case tcp.GlobalServiceIP: - By(fmt.Sprintf("Verifying that external app received request from one of podGlobalIPs %v", podGlobalIPs)) + framework.By(fmt.Sprintf("Verifying that external app received request from one of podGlobalIPs %v", podGlobalIPs)) matchRegexp := MatchRegexp("%s .*GET /%s%s .*", podGlobalIPs[0], p.Framework.Namespace, clusterName) for i := 1; i < len(podGlobalIPs); i++ { @@ -402,7 +402,7 @@ func testGlobalNetExternalConnectivity(p testParams, g globalnetTestParams) { Expect(dockerLog).To(matchRegexp) case tcp.GlobalPodIP: // For access from headless service, source IP is the globalIngressIP of the pod, which is set to remoteIP - By(fmt.Sprintf("Verifying that external app received request from globalIngressIP of the pod %v", remoteIP)) + framework.By(fmt.Sprintf("Verifying that external app received request from globalIngressIP of the pod %v", remoteIP)) Expect(dockerLog).To(MatchRegexp("%s .*GET /%s%s .*", remoteIP, p.Framework.Namespace, clusterName)) }