Skip to content

Commit

Permalink
e2e: RPS: fix expected cpu set (#703)
Browse files Browse the repository at this point in the history
Because of a logic oversight, the expected cpu set was overwritten
with the value expected for physical devices after the first loop
iteration. This broke the test when running on clusters with more
than a single worker node.

Signed-off-by: Francesco Romani <fromani@redhat.com>
Co-authored-by: Andrea Panattoni <apanatto@redhat.com>
  • Loading branch information
ffromani and zeeke committed Jul 2, 2023
1 parent e6fc0a0 commit b070a06
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,16 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() {
!*profile.Spec.WorkloadHints.RealTime && !profileutil.IsRpsEnabled(profile) {
Skip("realTime Workload Hints is not enabled")
}

expectedRPSCPUs, err := cpuset.Parse(string(*profile.Spec.CPU.Reserved))
Expect(err).ToNot(HaveOccurred())

expectedPhysRPSCPUs := expectedRPSCPUs.Clone()
if !profileutil.IsPhysicalRpsEnabled(profile) {
// empty cpuset
expectedPhysRPSCPUs = cpuset.NewCPUSet()
}

for _, node := range workerRTNodes {
// Verify the systemd RPS service uses the correct RPS mask
cmd := []string{"sysctl", "-n", "net.core.rps_default_mask"}
Expand Down Expand Up @@ -370,10 +378,6 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() {
}

By("verify RPS mask on physical network devices")
if !profileutil.IsPhysicalRpsEnabled(profile) {
// empty cpuset
expectedRPSCPUs = cpuset.NewCPUSet([]int{}...)
}
cmd = []string{
"find", "/rootfs/sys/devices",
"-regex", "/rootfs/sys/devices/pci.*",
Expand All @@ -387,7 +391,7 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() {
for _, devRPS := range strings.Split(devsRPS, "\n") {
rpsCPUs, err = components.CPUMaskToCPUSet(devRPS)
Expect(err).ToNot(HaveOccurred())
Expect(rpsCPUs.Equals(expectedRPSCPUs)).To(BeTrue(), "a host device rps mask is different from the reserved CPUs; have %q want %q", rpsCPUs.String(), expectedRPSCPUs.String())
Expect(rpsCPUs.Equals(expectedPhysRPSCPUs)).To(BeTrue(), "a host device rps mask is different from the reserved CPUs; have %q want %q", rpsCPUs.String(), expectedPhysRPSCPUs.String())
}
}
})
Expand Down

0 comments on commit b070a06

Please sign in to comment.