Skip to content

Commit

Permalink
e2e: addressed reviewers comments
Browse files Browse the repository at this point in the history
* Check the retunred output is not empty
* Use `GinkgoHelper()`

Signed-off-by: Talor Itzhak <titzhak@redhat.com>
  • Loading branch information
Tal-or committed Feb 8, 2024
1 parent 38bc10c commit 4d77c46
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -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())

Expand Down Expand Up @@ -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
}

0 comments on commit 4d77c46

Please sign in to comment.