From 4d77c46f2a3c117f1999be1bb437a35d3cfc91bc Mon Sep 17 00:00:00 2001 From: Talor Itzhak Date: Wed, 7 Feb 2024 17:56:17 +0200 Subject: [PATCH] e2e: addressed reviewers comments * Check the retunred output is not empty * Use `GinkgoHelper()` Signed-off-by: Talor Itzhak --- .../performanceprofile/functests/11_mixedcpus/mixedcpus.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go b/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go index b75f581350..283444e352 100644 --- a/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go +++ b/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go @@ -246,10 +246,12 @@ var _ = Describe("Mixedcpus", Ordered, func() { cmd := printMixedCPUsEnvCmd() output, err := pods.ExecCommandOnPod(testclient.K8sClient, p, "", cmd) Expect(err).ToNot(HaveOccurred(), "failed to execute command on pod; cmd=%q pod=%q", cmd, client.ObjectKeyFromObject(p).String()) + Expect(output).ToNot(BeEmpty()) isolatedAndShared := strings.Split(string(output), "\r\n") isolatedFromEnv := mustParse(isolatedAndShared[0]) Expect(isolatedFromEnv.IsEmpty()).ToNot(BeTrue()) sharedFromEnv := mustParse(isolatedAndShared[1]) + Expect(sharedFromEnv.IsEmpty()).ToNot(BeTrue()) Expect(sharedFromEnv.Equals(newShared)).To(BeTrue(), "OPENSHIFT_SHARED_CPUS value not equal to what configure in the performance profile."+ "OPENSHIFT_SHARED_CPUS=%s spec.cpu.shared=%s", sharedFromEnv.String(), newShared.String()) @@ -394,7 +396,8 @@ func getTestingNamespace() corev1.Namespace { } func mustParse(cpus string) *cpuset.CPUSet { + GinkgoHelper() set, err := cpuset.Parse(cpus) - ExpectWithOffset(1, err).ToNot(HaveOccurred(), "failed to parse cpuset; cpus=%q", cpus) + Expect(err).ToNot(HaveOccurred(), "failed to parse cpuset; cpus=%q", cpus) return &set }