Skip to content

Commit

Permalink
Added a test to verify system processes are in the correct cgroup
Browse files Browse the repository at this point in the history
When we are using cgroups v1 we are counting on the cpuset-configure.service
to move all the system services to the custom system.slice.
This test ensures the service indeed moved them.

It is also a good practice to check for similar errors on cgroup v2 systems.

Signed-off-by: Ronny Baturov <rbaturov@redhat.com>
  • Loading branch information
rbaturov committed Mar 21, 2024
1 parent a04faf5 commit deffc0c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/e2e/performanceprofile/functests/1_performance/performance.go
Expand Up @@ -32,6 +32,7 @@ import (
componentprofile "github.com/openshift/cluster-node-tuning-operator/pkg/performanceprofile/controller/performanceprofile/components/profile"
profileutil "github.com/openshift/cluster-node-tuning-operator/pkg/performanceprofile/controller/performanceprofile/components/profile"
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/cgroup"
testclient "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/client"
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/cluster"
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/discovery"
Expand Down Expand Up @@ -282,6 +283,29 @@ var _ = Describe("[rfe_id:27368][performance]", Ordered, func() {
})
})

Context("Using performance profile", func() {
It("Should have system services running on the system.slice cgroup", func() {
for _, node := range workerRTNodes {
processesFound := make([]string, 0)
rootCgroupPath := "/rootfs/sys/fs/cgroup/cpuset/cgroup.procs"
isV2, err := cgroup.IsVersion2(context.TODO(), testclient.Client)
if err != nil {
Expect(err).ToNot(HaveOccurred())
}
if isV2 {
rootCgroupPath = "/rootfs/sys/fs/cgroup/cgroup.procs"
}
// Getting the list of processes that are running on the root cgroup, filtering out the kernel threads (are presented in [square brackets]).
command := fmt.Sprintf("cat %s | xargs ps -o cmd | grep -v \"\\[\"", rootCgroupPath)
output, err := nodes.ExecCommandOnNode(context.TODO(), []string{"/bin/bash", "-c", command}, &node)
Expect(err).ToNot(HaveOccurred())
cmds := strings.Split(output, "\n")
processesFound = append(processesFound, cmds[1:]...)
Expect(processesFound).To(BeEmpty(), "The node %s has the following processes on the root cgroup: %v", node.Name, processesFound)
}
})
})

Context("Tuned kernel parameters", func() {
It("[test_id:28466][crit:high][vendor:cnf-qe@redhat.com][level:acceptance] Should contain configuration injected through openshift-node-performance profile", func() {
sysctlMap := map[string]string{
Expand Down

0 comments on commit deffc0c

Please sign in to comment.