From 258a375b35facb3a2c747db51fbcad7c928685c5 Mon Sep 17 00:00:00 2001 From: oblau Date: Thu, 23 Jul 2026 13:13:47 +0300 Subject: [PATCH 1/3] E2E: add missing matcher to offlined CPU Expect() calls (5 sites) Expect(bool) without .To() is a Gomega no-op; these tests never fail on these assertions. --- .../functests/2_performance_update/updating_profile.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/performanceprofile/functests/2_performance_update/updating_profile.go b/test/e2e/performanceprofile/functests/2_performance_update/updating_profile.go index ce53fbd91..d28c71333 100644 --- a/test/e2e/performanceprofile/functests/2_performance_update/updating_profile.go +++ b/test/e2e/performanceprofile/functests/2_performance_update/updating_profile.go @@ -637,7 +637,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance Expect(err).ToNot(HaveOccurred()) offlinedCPUSetProfile, err := cpuset.Parse(string(offlined)) Expect(err).ToNot(HaveOccurred()) - Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)) + Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)).To(BeTrue(), "offlined CPUs mismatch: expected %q, got %q", offlinedCPUSetProfile, offlinedCPUSet) } }) @@ -707,7 +707,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance Expect(err).ToNot(HaveOccurred()) offlinedCPUSetProfile, err := cpuset.Parse(string(offlinedSet)) Expect(err).ToNot(HaveOccurred()) - Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)) + Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)).To(BeTrue(), "offlined CPUs mismatch: expected %q, got %q", offlinedCPUSetProfile, offlinedCPUSet) } }) @@ -770,7 +770,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance Expect(err).ToNot(HaveOccurred()) offlinedCPUSetProfile, err := cpuset.Parse(string(offlinedSet)) Expect(err).ToNot(HaveOccurred()) - Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)) + Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)).To(BeTrue(), "offlined CPUs mismatch: expected %q, got %q", offlinedCPUSetProfile, offlinedCPUSet) } }) @@ -840,7 +840,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance Expect(err).ToNot(HaveOccurred()) offlinedCPUSetProfile, err := cpuset.Parse(string(offlinedSet)) Expect(err).ToNot(HaveOccurred()) - Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)) + Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)).To(BeTrue(), "offlined CPUs mismatch: expected %q, got %q", offlinedCPUSetProfile, offlinedCPUSet) } }) @@ -966,7 +966,7 @@ var _ = Describe("[rfe_id:28761][performance] Updating parameters in performance Expect(err).ToNot(HaveOccurred()) offlinedCPUSetProfile, err := cpuset.Parse(string(offlinedSet)) Expect(err).ToNot(HaveOccurred()) - Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)) + Expect(offlinedCPUSet.Equals(offlinedCPUSetProfile)).To(BeTrue(), "offlined CPUs mismatch: expected %q, got %q", offlinedCPUSetProfile, offlinedCPUSet) } }) From 9bd37cd798c6e6daa8462c6ca5eadc70d49a66b4 Mon Sep 17 00:00:00 2001 From: oblau Date: Thu, 23 Jul 2026 13:16:51 +0300 Subject: [PATCH 2/3] E2E: add missing error check to mixedcpus Get() calls (3 sites) Expect(Get(...)) without .ToNot(HaveOccurred()) is a Gomega no-op; API errors were silently swallowed. Split into err assignment + Expect(err) to match the prevailing style in the file. --- .../functests/11_mixedcpus/mixedcpus.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go b/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go index fcd5914c3..64c78d8c0 100644 --- a/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go +++ b/test/e2e/performanceprofile/functests/11_mixedcpus/mixedcpus.go @@ -320,8 +320,8 @@ var _ = Describe("Mixedcpus", Ordered, Label(string(label.MixedCPUs)), func() { By(fmt.Sprintf("Waiting when %s finishes updates", poolName)) profilesupdate.WaitForTuningUpdated(context.TODO(), profile) - Expect(testclient.ControlPlaneClient.Get(ctx, client.ObjectKeyFromObject(profile), profile)) - testlog.Infof("new isolated CPU set=%q\nnew shared CPU set=%q", string(*profile.Spec.CPU.Isolated), string(*profile.Spec.CPU.Isolated)) + Expect(testclient.ControlPlaneClient.Get(ctx, client.ObjectKeyFromObject(profile), profile)).To(Succeed()) + testlog.Infof("new isolated CPU set=%q\nnew shared CPU set=%q", string(*profile.Spec.CPU.Isolated), string(*profile.Spec.CPU.Shared)) // we do not bother to revert the profile at the end of the test, since its irrelevant which of the cpus are shared }) @@ -502,7 +502,7 @@ var _ = Describe("Mixedcpus", Ordered, Label(string(label.MixedCPUs)), func() { Expect(pod.Status.Phase).To(Equal(corev1.PodPending), "Pod %s is not in the pending state", pod.Name) By("Reverting the cluster to previous state") - Expect(testclient.ControlPlaneClient.Get(ctx, client.ObjectKeyFromObject(profile), profile)) + Expect(testclient.ControlPlaneClient.Get(ctx, client.ObjectKeyFromObject(profile), profile)).To(Succeed()) profile.Spec.CPU.Shared = cpuSetToPerformanceCPUSet(ppShared) profile.Spec.WorkloadHints.MixedCpus = ptr.To(true) profiles.UpdateWithRetry(profile) @@ -872,7 +872,7 @@ func setup(ctx context.Context) func(ctx2 context.Context) { teardown := func(ctx2 context.Context) { By(fmt.Sprintf("executing teardown - revert profile %q back to its initial state", profile.Name)) - Expect(testclient.ControlPlaneClient.Get(ctx2, client.ObjectKeyFromObject(initialProfile), profile)) + Expect(testclient.ControlPlaneClient.Get(ctx2, client.ObjectKeyFromObject(initialProfile), profile)).To(Succeed()) profiles.UpdateWithRetry(initialProfile) // do not wait if nothing has changed From 9c24e1d01f1019df2d56989d8ad5552d570f659f Mon Sep 17 00:00:00 2001 From: oblau Date: Thu, 23 Jul 2026 13:27:31 +0300 Subject: [PATCH 3/3] E2E: PPC: replace no-op log-on-match with actual assertions (4 sites) The `if ok { testlog.Info(...) }` pattern after regexp.MatchString never failed the test when the expected error was absent from output. Replace with Expect(ok).To(BeTrue()) so a missing error message actually fails the test case. --- .../functests/10_performance_ppc/ppc.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/e2e/performanceprofile/functests/10_performance_ppc/ppc.go b/test/e2e/performanceprofile/functests/10_performance_ppc/ppc.go index 51c988623..0b1d3de68 100644 --- a/test/e2e/performanceprofile/functests/10_performance_ppc/ppc.go +++ b/test/e2e/performanceprofile/functests/10_performance_ppc/ppc.go @@ -12,7 +12,6 @@ import ( performancev2 "github.com/openshift/cluster-node-tuning-operator/pkg/apis/performanceprofile/v2" testutils "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils" "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/label" - testlog "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/log" "k8s.io/utils/cpuset" "sigs.k8s.io/yaml" ) @@ -120,9 +119,7 @@ var _ = Describe("[rfe_id: 38968] PerformanceProfile setup helper and platform a errString := "Error: failed to obtain data from flags not appropriate to split reserved CPUs in case of topology-manager-policy: single-numa-node" ok, err := regexp.MatchString(errString, string(output)) Expect(err).ToNot(HaveOccurred()) - if ok { - testlog.Info(errString) - } + Expect(ok).To(BeTrue(), "expected error %q not found in output: %s", errString, output) Eventually(session).Should(gexec.Exit(1)) }) @@ -144,9 +141,7 @@ var _ = Describe("[rfe_id: 38968] PerformanceProfile setup helper and platform a errString := "Error: failed to compute the reserved and isolated CPUs: can't allocate odd number of CPUs from a NUMA Node" ok, err := regexp.MatchString(errString, string(output)) Expect(err).ToNot(HaveOccurred(), "did not fail with Expected:%s failure", errString) - if ok { - testlog.Info(errString) - } + Expect(ok).To(BeTrue(), "expected error %q not found in output: %s", errString, output) Eventually(session).Should(gexec.Exit(1)) }) @@ -169,9 +164,7 @@ var _ = Describe("[rfe_id: 38968] PerformanceProfile setup helper and platform a errString := "Error: failed to compute the reserved and isolated CPUs: please specify the reserved CPU count in the range [1,3]" ok, err := regexp.MatchString(errString, string(output)) Expect(err).ToNot(HaveOccurred(), "did not fail with Expected:%s failure", errString) - if ok { - testlog.Info(errString) - } + Expect(ok).To(BeTrue(), "expected error %q not found in output: %s", errString, output) Eventually(session).Should(gexec.Exit(1)) }) @@ -217,9 +210,7 @@ var _ = Describe("[rfe_id: 38968] PerformanceProfile setup helper and platform a errString := `please use one of \[default low-latency\] power consumption modes together with the perPodPowerManagement` ok, err := regexp.MatchString(errString, string(output)) Expect(err).ToNot(HaveOccurred(), "did not fail with Expected:%s failure", errString) - if ok { - testlog.Info(errString) - } + Expect(ok).To(BeTrue(), "expected error %q not found in output: %s", errString, output) Eventually(session).Should(gexec.Exit(1)) }) })