From 7aedd9afff37f99bfab2ace9ce5b74cb5f03c8c4 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Tue, 2 Apr 2024 08:16:46 -0400 Subject: [PATCH] Use shipyard framework By instaed 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/discovery/headless_services.go | 50 ++++++++-------- test/e2e/discovery/service_discovery.go | 80 ++++++++++++------------- test/e2e/discovery/statefulsets.go | 22 +++---- test/e2e/framework/framework.go | 32 +++++----- test/e2e/internal/service_discovery.go | 10 ++-- 5 files changed, 97 insertions(+), 97 deletions(-) diff --git a/test/e2e/discovery/headless_services.go b/test/e2e/discovery/headless_services.go index 97675909e..9701d4538 100644 --- a/test/e2e/discovery/headless_services.go +++ b/test/e2e/discovery/headless_services.go @@ -72,17 +72,17 @@ func RunHeadlessDiscoveryTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxHeadlessClusterB := f.NewNginxHeadlessService(framework.ClusterB) f.NewServiceExport(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -110,9 +110,9 @@ func RunHeadlessDiscoveryLocalAndRemoteTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxHeadlessClusterB := f.NewNginxHeadlessService(framework.ClusterB) @@ -120,9 +120,9 @@ func RunHeadlessDiscoveryLocalAndRemoteTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) f.AwaitAggregatedServiceImport(framework.ClusterA, nginxHeadlessClusterB, 1) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) f.NewNginxDeployment(framework.ClusterA) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) nginxHeadlessClusterA := f.NewNginxHeadlessService(framework.ClusterA) @@ -130,7 +130,7 @@ func RunHeadlessDiscoveryLocalAndRemoteTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterA, nginxHeadlessClusterA.Name, nginxHeadlessClusterA.Namespace) f.AwaitAggregatedServiceImport(framework.ClusterA, nginxHeadlessClusterA, 2) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -166,18 +166,18 @@ func RunHeadlessEndpointDiscoveryTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating a Headless Service without selector on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Headless Service without selector on %q", clusterBName)) headlessClusterB := f.NewHeadlessServiceEndpointIP(framework.ClusterB) - By("Creating an endpoint") + framework.By("Creating an endpoint") f.NewEndpointForHeadlessService(framework.ClusterB, headlessClusterB) - By("Exporting the service %q") + framework.By("Exporting the service %q") f.NewServiceExport(framework.ClusterB, headlessClusterB.Name, headlessClusterB.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterB, headlessClusterB.Name, headlessClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -205,11 +205,11 @@ func RunHeadlessPodsAvailabilityTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) f.SetNginxReplicaSet(framework.ClusterB, 3) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxHeadlessClusterB := f.NewNginxHeadlessService(framework.ClusterB) @@ -217,7 +217,7 @@ func RunHeadlessPodsAvailabilityTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -239,11 +239,11 @@ func RunHeadlessPodsAvailabilityTest(f *lhframework.Framework) { func RunHeadlessPodsAvailabilityTestLocal(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) f.NewNginxDeployment(framework.ClusterA) f.SetNginxReplicaSet(framework.ClusterA, 3) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) nginxHeadlessClusterA := f.NewNginxHeadlessService(framework.ClusterA) @@ -251,7 +251,7 @@ func RunHeadlessPodsAvailabilityTestLocal(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterA, nginxHeadlessClusterA.Name, nginxHeadlessClusterA.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -274,27 +274,27 @@ func RunHeadlessDiscoveryClusterNameTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) f.NewNginxDeployment(framework.ClusterA) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) nginxHeadlessClusterA := f.NewNginxHeadlessService(framework.ClusterA) f.NewServiceExport(framework.ClusterA, nginxHeadlessClusterA.Name, nginxHeadlessClusterA.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterA, nginxHeadlessClusterA.Name, nginxHeadlessClusterA.Namespace) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxHeadlessClusterB := f.NewNginxHeadlessService(framework.ClusterB) f.NewServiceExport(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxHeadlessClusterB.Name, nginxHeadlessClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -332,7 +332,7 @@ func verifyHeadlessSRVRecordsWithDig(f *framework.Framework, cluster framework.C op += " not" } - By(fmt.Sprintf("Executing %q to verify hostNames %v for service %q %q discoverable", + framework.By(fmt.Sprintf("Executing %q to verify hostNames %v for service %q %q discoverable", strings.Join(cmd, " "), hostNameList, service.Name, op)) framework.AwaitUntil(" service IP verification", func() (interface{}, error) { stdout, _, err := f.ExecWithOptions(context.TODO(), &framework.ExecOptions{ @@ -349,7 +349,7 @@ func verifyHeadlessSRVRecordsWithDig(f *framework.Framework, cluster framework.C return stdout, nil }, func(result interface{}) (bool, string, error) { - By(fmt.Sprintf("Validating that dig result %s %q", op, result)) + framework.By(fmt.Sprintf("Validating that dig result %s %q", op, result)) if len(hostNameList) == 0 && result != "" { return false, fmt.Sprintf("expected execution result %q to be empty", result), nil diff --git a/test/e2e/discovery/service_discovery.go b/test/e2e/discovery/service_discovery.go index 6964c7b1d..f999c899b 100644 --- a/test/e2e/discovery/service_discovery.go +++ b/test/e2e/discovery/service_discovery.go @@ -119,10 +119,10 @@ func RunServiceDiscoveryTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -130,7 +130,7 @@ func RunServiceDiscoveryTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -160,7 +160,7 @@ func RunServiceDiscoveryTest(f *lhframework.Framework) { verifySRVWithDig(f.Framework, framework.ClusterA, nginxServiceClusterB, netshootPodList, checkedDomains, "", false, false) - By(fmt.Sprintf("Re-creating Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Re-creating Nginx Service on %q", clusterBName)) nginxServiceClusterB.ObjectMeta = metav1.ObjectMeta{ Name: nginxServiceClusterB.Name, @@ -188,17 +188,17 @@ func RunServiceDiscoveryLocalTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) f.NewNginxDeployment(framework.ClusterA) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterAName)) // don't need ServiceExport for local service nginxServiceClusterA := f.Framework.NewNginxService(framework.ClusterA) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -206,7 +206,7 @@ func RunServiceDiscoveryLocalTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) clusterADomain := getClusterDomain(f.Framework, framework.ClusterA, netshootPodList) @@ -241,16 +241,16 @@ func RunServiceExportTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx ServiceExport on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx ServiceExport on %q", clusterBName)) f.NewServiceExport(framework.ClusterB, "nginx-demo", f.Namespace) - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -275,9 +275,9 @@ func RunServicesPodAvailabilityTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -285,7 +285,7 @@ func RunServicesPodAvailabilityTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -323,10 +323,10 @@ func RunServicesPodAvailabilityMultiClusterTest(f *lhframework.Framework) { clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] clusterCName := framework.TestContext.ClusterIDs[framework.ClusterC] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -334,16 +334,16 @@ func RunServicesPodAvailabilityMultiClusterTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterCName)) f.NewNginxDeployment(framework.ClusterC) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) nginxServiceClusterC := f.Framework.NewNginxService(framework.ClusterC) f.NewServiceExport(framework.ClusterC, nginxServiceClusterC.Name, nginxServiceClusterC.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -397,19 +397,19 @@ func RunServiceDiscoveryClusterNameTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterAName)) f.NewNginxDeployment(framework.ClusterA) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterAName)) nginxServiceClusterA := f.Framework.NewNginxService(framework.ClusterA) f.NewServiceExport(framework.ClusterA, nginxServiceClusterA.Name, nginxServiceClusterA.Namespace) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -417,7 +417,7 @@ func RunServiceDiscoveryClusterNameTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -456,10 +456,10 @@ func RunServiceDiscoveryRoundRobinTest(f *lhframework.Framework) { clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] clusterCName := framework.TestContext.ClusterIDs[framework.ClusterC] - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -467,16 +467,16 @@ func RunServiceDiscoveryRoundRobinTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on %q", clusterCName)) f.NewNginxDeployment(framework.ClusterC) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) nginxServiceClusterC := f.Framework.NewNginxService(framework.ClusterC) f.NewServiceExport(framework.ClusterC, nginxServiceClusterC.Name, nginxServiceClusterC.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -511,9 +511,9 @@ func RunServicesClusterAvailabilityMultiClusterTest(f *lhframework.Framework) { clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] clusterCName := framework.TestContext.ClusterIDs[framework.ClusterC] - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -521,7 +521,7 @@ func RunServicesClusterAvailabilityMultiClusterTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterCName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -533,9 +533,9 @@ func RunServicesClusterAvailabilityMultiClusterTest(f *lhframework.Framework) { f.AwaitEndpointSlices(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace, 1, 1) f.AwaitEndpointSlices(framework.ClusterA, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace, 1, 1) - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterCName)) f.NewNginxDeployment(framework.ClusterC) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterCName)) nginxServiceClusterC := f.NewNginxService(framework.ClusterC) @@ -579,7 +579,7 @@ func verifySRVWithDig(f *framework.Framework, srcCluster framework.ClusterIndex, op += " not" } - By(fmt.Sprintf("Executing %q to verify SRV record for service %q %q discoverable", strings.Join(cmd, " "), + framework.By(fmt.Sprintf("Executing %q to verify SRV record for service %q %q discoverable", strings.Join(cmd, " "), service.Name, op)) framework.AwaitUntil("verify if service Ports is discoverable", func() (interface{}, error) { stdout, _, err := f.ExecWithOptions(context.TODO(), &framework.ExecOptions{ @@ -605,7 +605,7 @@ func verifySRVWithDig(f *framework.Framework, srcCluster framework.ClusterIndex, strings.Contains(result.(string), clusterDNSName) } - By(fmt.Sprintf("Validating that port in dig result for SRV Record %q %s %d and the domain name %s %q", result, + framework.By(fmt.Sprintf("Validating that port in dig result for SRV Record %q %s %d and the domain name %s %q", result, op, port.Port, op, clusterDNSName)) if doesContain && !shouldContain { @@ -633,7 +633,7 @@ func verifyRoundRobinWithDig(f *framework.Framework, srcCluster framework.Cluste serviceIPMap := make(map[string]int) - By(fmt.Sprintf("Executing %q to verify IPs %q for service %q are discoverable in a"+ + framework.By(fmt.Sprintf("Executing %q to verify IPs %q for service %q are discoverable in a"+ " round-robin fashion", strings.Join(cmd, " "), serviceIPList, serviceName)) var retIPs []string @@ -667,7 +667,7 @@ func verifyRoundRobinWithDig(f *framework.Framework, srcCluster framework.Cluste }) } - By(fmt.Sprintf("Service IP %q was returned %d times and Service IP %q was returned %d times - "+ + framework.By(fmt.Sprintf("Service IP %q was returned %d times and Service IP %q was returned %d times - "+ "verifying the difference between them is within the threshold", serviceIPList[0], serviceIPMap[serviceIPList[0]], serviceIPList[1], serviceIPMap[serviceIPList[1]])) diff --git a/test/e2e/discovery/statefulsets.go b/test/e2e/discovery/statefulsets.go index d6aee2a2b..448c4fd1e 100644 --- a/test/e2e/discovery/statefulsets.go +++ b/test/e2e/discovery/statefulsets.go @@ -58,12 +58,12 @@ func RunSSDiscoveryTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) nginxSSClusterB := f.NewNginxStatefulSet(framework.ClusterB) appName := nginxSSClusterB.Spec.Selector.MatchLabels["app"] - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxServiceClusterB := f.NewHeadlessServiceWithParams(nginxSSClusterB.Spec.ServiceName, httpPortName, corev1.ProtocolTCP, map[string]string{"app": appName}, framework.ClusterB) @@ -71,7 +71,7 @@ func RunSSDiscoveryTest(f *lhframework.Framework) { f.NewServiceExport(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -91,22 +91,22 @@ func RunSSDiscoveryLocalTest(f *lhframework.Framework) { clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] // Create StatefulSet on ClusterB - By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) nginxSSClusterB := f.NewNginxStatefulSet(framework.ClusterB) appName := nginxSSClusterB.Spec.Selector.MatchLabels["app"] - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxServiceClusterB := f.NewHeadlessServiceWithParams(nginxSSClusterB.Spec.ServiceName, httpPortName, corev1.ProtocolTCP, map[string]string{"app": appName}, framework.ClusterB) // Create StatefulSet on ClusterA - By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterAName)) nginxSSClusterA := f.NewNginxStatefulSet(framework.ClusterA) - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterAName)) nginxServiceClusterA := f.NewHeadlessServiceWithParams(nginxSSClusterA.Spec.ServiceName, httpPortName, corev1.ProtocolTCP, map[string]string{"app": appName}, framework.ClusterA) @@ -117,7 +117,7 @@ func RunSSDiscoveryLocalTest(f *lhframework.Framework) { f.NewServiceExport(framework.ClusterA, nginxServiceClusterA.Name, nginxServiceClusterA.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterA, nginxServiceClusterA.Name, nginxServiceClusterA.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) @@ -153,14 +153,14 @@ func RunSSPodsAvailabilityTest(f *lhframework.Framework) { clusterAName := framework.TestContext.ClusterIDs[framework.ClusterA] clusterBName := framework.TestContext.ClusterIDs[framework.ClusterB] - By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Stateful Set on %q", clusterBName)) nginxSSClusterB := f.NewNginxStatefulSet(framework.ClusterB) f.SetNginxStatefulSetReplicas(framework.ClusterB, 3) appName := nginxSSClusterB.Spec.Selector.MatchLabels["app"] - By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Headless Service on %q", clusterBName)) nginxServiceClusterB := f.NewHeadlessServiceWithParams(nginxSSClusterB.Spec.ServiceName, httpPortName, corev1.ProtocolTCP, map[string]string{"app": appName}, framework.ClusterB) @@ -168,7 +168,7 @@ func RunSSPodsAvailabilityTest(f *lhframework.Framework) { f.NewServiceExport(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeployment(framework.ClusterA) diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index ee2dac478..047f708d2 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -137,7 +137,7 @@ func (f *Framework) NewServiceExport(cluster framework.ClusterIndex, name, names }, } se := MCSClients[cluster].MulticlusterV1alpha1().ServiceExports(namespace) - By(fmt.Sprintf("Creating serviceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Creating serviceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) serviceExport := framework.AwaitUntil("create serviceExport", func() (interface{}, error) { return se.Create(context.TODO(), &nginxServiceExport, metav1.CreateOptions{}) }, framework.NoopCheckResult).(*mcsv1a1.ServiceExport) @@ -146,7 +146,7 @@ func (f *Framework) NewServiceExport(cluster framework.ClusterIndex, name, names } func (f *Framework) AwaitServiceExportedStatusCondition(cluster framework.ClusterIndex, name, namespace string) { - By(fmt.Sprintf("Retrieving ServiceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Retrieving ServiceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) se := MCSClients[cluster].MulticlusterV1alpha1().ServiceExports(namespace) @@ -174,7 +174,7 @@ func (f *Framework) AwaitServiceExportedStatusCondition(cluster framework.Cluste } func (f *Framework) DeleteServiceExport(cluster framework.ClusterIndex, name, namespace string) { - By(fmt.Sprintf("Deleting serviceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Deleting serviceExport %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) framework.AwaitUntil("delete service export", func() (interface{}, error) { return nil, MCSClients[cluster].MulticlusterV1alpha1().ServiceExports(namespace).Delete( context.TODO(), name, metav1.DeleteOptions{}) @@ -182,12 +182,12 @@ func (f *Framework) DeleteServiceExport(cluster framework.ClusterIndex, name, na } func (f *Framework) GetService(cluster framework.ClusterIndex, name, namespace string) (*v1.Service, error) { - By(fmt.Sprintf("Retrieving service %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Retrieving service %s.%s on %q", name, namespace, framework.TestContext.ClusterIDs[cluster])) return framework.KubeClients[cluster].CoreV1().Services(namespace).Get(context.TODO(), name, metav1.GetOptions{}) } func (f *Framework) AwaitAggregatedServiceImport(targetCluster framework.ClusterIndex, svc *v1.Service, clusterCount int) { - By(fmt.Sprintf("Retrieving ServiceImport for %q in ns %q on %q", svc.Name, svc.Namespace, + framework.By(fmt.Sprintf("Retrieving ServiceImport for %q in ns %q on %q", svc.Name, svc.Namespace, framework.TestContext.ClusterIDs[targetCluster])) si := MCSClients[targetCluster].MulticlusterV1alpha1().ServiceImports(svc.Namespace) @@ -325,7 +325,7 @@ func (f *Framework) AwaitEndpointIPs(targetCluster framework.ClusterIndex, name, namespace string, count int, ) (ipList, hostNameList []string) { client := framework.KubeClients[targetCluster].DiscoveryV1().EndpointSlices(namespace) - By(fmt.Sprintf("Retrieving Endpoints for %s on %q", name, framework.TestContext.ClusterIDs[targetCluster])) + framework.By(fmt.Sprintf("Retrieving Endpoints for %s on %q", name, framework.TestContext.ClusterIDs[targetCluster])) framework.AwaitUntil("retrieve Endpoints", func() (interface{}, error) { return client.List(context.Background(), metav1.ListOptions{ LabelSelector: labels.SelectorFromSet(map[string]string{ @@ -440,7 +440,7 @@ func (f *Framework) GetEndpointIPs(targetCluster framework.ClusterIndex, svc *v1 } func (f *Framework) SetNginxReplicaSet(cluster framework.ClusterIndex, count uint32) *appsv1.Deployment { - By(fmt.Sprintf("Setting Nginx deployment replicas to %v in cluster %q", count, framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Setting Nginx deployment replicas to %v in cluster %q", count, framework.TestContext.ClusterIDs[cluster])) patch := fmt.Sprintf(`{"spec":{"replicas":%v}}`, count) deployments := framework.KubeClients[cluster].AppsV1().Deployments(f.Namespace) result := framework.AwaitUntil("set replicas", func() (interface{}, error) { @@ -521,7 +521,7 @@ func (f *Framework) AwaitEndpointSlices(targetCluster framework.ClusterIndex, na LabelSelector: labels.Set(labelMap).String(), } - By(fmt.Sprintf("Retrieving EndpointSlices for %q in ns %q on %q", name, namespace, + framework.By(fmt.Sprintf("Retrieving EndpointSlices for %q in ns %q on %q", name, namespace, framework.TestContext.ClusterIDs[targetCluster])) framework.AwaitUntil("retrieve EndpointSlices", func() (interface{}, error) { return ep.List(context.TODO(), listOptions) @@ -558,7 +558,7 @@ func (f *Framework) AwaitEndpointSlices(targetCluster framework.ClusterIndex, na } func (f *Framework) SetNginxStatefulSetReplicas(cluster framework.ClusterIndex, count uint32) *appsv1.StatefulSet { - By(fmt.Sprintf("Setting Nginx statefulset replicas to %v", count)) + framework.By(fmt.Sprintf("Setting Nginx statefulset replicas to %v", count)) patch := fmt.Sprintf(`{"spec":{"replicas":%v}}`, count) ss := framework.KubeClients[cluster].AppsV1().StatefulSets(f.Namespace) result := framework.AwaitUntil("set replicas", func() (interface{}, error) { @@ -575,7 +575,7 @@ func (f *Framework) GetHealthCheckIPInfo(cluster framework.ClusterIndex) (endpoi }, func(result interface{}) (bool, string, error) { unstructuredEndpointList := result.(*unstructured.UnstructuredList) for _, endpoint := range unstructuredEndpointList.Items { - By(fmt.Sprintf("Getting the endpoint %s, for cluster %s", endpoint.GetName(), framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Getting the endpoint %s, for cluster %s", endpoint.GetName(), framework.TestContext.ClusterIDs[cluster])) if strings.Contains(endpoint.GetName(), framework.TestContext.ClusterIDs[cluster]) { endpointName = endpoint.GetName() @@ -608,7 +608,7 @@ func (f *Framework) GetHealthCheckEnabledInfo(cluster framework.ClusterIndex) (h }, func(result interface{}) (bool, string, error) { unstructuredSubmarinerConfig := result.(*unstructured.Unstructured) - By(fmt.Sprintf("Getting the Submariner Config, for cluster %s", framework.TestContext.ClusterIDs[cluster])) + framework.By(fmt.Sprintf("Getting the Submariner Config, for cluster %s", framework.TestContext.ClusterIDs[cluster])) var found bool var err error @@ -626,7 +626,7 @@ func (f *Framework) GetHealthCheckEnabledInfo(cluster framework.ClusterIndex) (h } func (f *Framework) SetHealthCheckIP(cluster framework.ClusterIndex, ip, endpointName string) { - By(fmt.Sprintf("Setting health check IP cluster %q to %v", framework.TestContext.ClusterIDs[cluster], ip)) + framework.By(fmt.Sprintf("Setting health check IP cluster %q to %v", framework.TestContext.ClusterIDs[cluster], ip)) patch := fmt.Sprintf(`{"spec":{"healthCheckIP":%q}}`, ip) framework.AwaitUntil("set healthCheckIP", func() (interface{}, error) { @@ -667,7 +667,7 @@ func (f *Framework) VerifyIPWithDig(srcCluster framework.ClusterIndex, service * op += not } - By(fmt.Sprintf("Executing %q to verify IP %q for service %q %q discoverable", strings.Join(cmd, " "), serviceIP, service.Name, op)) + framework.By(fmt.Sprintf("Executing %q to verify IP %q for service %q %q discoverable", strings.Join(cmd, " "), serviceIP, service.Name, op)) framework.AwaitUntil("verify if service IP is discoverable", func() (interface{}, error) { stdout, _, err := f.ExecWithOptions(context.TODO(), &framework.ExecOptions{ Command: cmd, @@ -684,7 +684,7 @@ func (f *Framework) VerifyIPWithDig(srcCluster framework.ClusterIndex, service * return stdout, nil }, func(result interface{}) (bool, string, error) { doesContain := strings.Contains(result.(string), serviceIP) - By(fmt.Sprintf("Validating that dig result %q %s %q", result, op, serviceIP)) + framework.By(fmt.Sprintf("Validating that dig result %q %s %q", result, op, serviceIP)) if doesContain && !shouldContain { return false, fmt.Sprintf("expected execution result %q not to contain %q", result, serviceIP), nil @@ -717,7 +717,7 @@ func (f *Framework) VerifyIPsWithDig(cluster framework.ClusterIndex, service *v1 op += not } - By(fmt.Sprintf("Executing %q to verify IPs %v for service %q %q discoverable", strings.Join(cmd, " "), ipList, service.Name, op)) + framework.By(fmt.Sprintf("Executing %q to verify IPs %v for service %q %q discoverable", strings.Join(cmd, " "), ipList, service.Name, op)) framework.AwaitUntil(" service IP verification", func() (interface{}, error) { stdout, _, err := f.ExecWithOptions(context.TODO(), &framework.ExecOptions{ Command: cmd, @@ -733,7 +733,7 @@ func (f *Framework) VerifyIPsWithDig(cluster framework.ClusterIndex, service *v1 return stdout, nil }, func(result interface{}) (bool, string, error) { - By(fmt.Sprintf("Validating that dig result %s %q", op, result)) + framework.By(fmt.Sprintf("Validating that dig result %s %q", op, result)) if len(ipList) == 0 && result != "" { return false, fmt.Sprintf("expected execution result %q to be empty", result), nil diff --git a/test/e2e/internal/service_discovery.go b/test/e2e/internal/service_discovery.go index b581894b6..ca0ddf04f 100644 --- a/test/e2e/internal/service_discovery.go +++ b/test/e2e/internal/service_discovery.go @@ -52,17 +52,17 @@ func RunNonexistentNamespaceDiscoveryTest(f *lhframework.Framework) { }, metav1.CreateOptions{}) Expect(err).NotTo(HaveOccurred(), "Error creating namespace") - By(fmt.Sprintf("Created namespace %q for netshoot deployment on %q", netshootNS.Name, clusterAName)) + framework.By(fmt.Sprintf("Created namespace %q for netshoot deployment on %q", netshootNS.Name, clusterAName)) f.AddNamespacesToDelete(netshootNS) Expect(framework.KubeClients[framework.ClusterA].CoreV1().Namespaces().Delete(context.TODO(), f.Namespace, metav1.DeleteOptions{})).To(Succeed()) - By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating an Nginx Deployment on on %q", clusterBName)) f.NewNginxDeployment(framework.ClusterB) - By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) + framework.By(fmt.Sprintf("Creating a Nginx Service on %q", clusterBName)) nginxServiceClusterB := f.NewNginxService(framework.ClusterB) @@ -70,7 +70,7 @@ func RunNonexistentNamespaceDiscoveryTest(f *lhframework.Framework) { f.AwaitServiceExportedStatusCondition(framework.ClusterB, nginxServiceClusterB.Name, nginxServiceClusterB.Namespace) - By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) + framework.By(fmt.Sprintf("Creating a Netshoot Deployment on %q", clusterAName)) netshootPodList := f.NewNetShootDeploymentInNS(framework.ClusterA, netshootNS.Name) @@ -85,7 +85,7 @@ func RunNonexistentNamespaceDiscoveryTest(f *lhframework.Framework) { "", false) } - By(fmt.Sprintf("Recreating namespace %q on %q", f.Namespace, clusterAName)) + framework.By(fmt.Sprintf("Recreating namespace %q on %q", f.Namespace, clusterAName)) _, err = framework.KubeClients[framework.ClusterA].CoreV1().Namespaces().Create(context.TODO(), &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{