66
77 g "github.com/onsi/ginkgo/v2"
88 o "github.com/onsi/gomega"
9+
910 exutil "github.com/openshift/origin/test/extended/util"
1011 "k8s.io/apimachinery/pkg/util/wait"
1112 e2e "k8s.io/kubernetes/test/e2e/framework"
@@ -16,20 +17,20 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
1617 oc = exutil .NewCLIWithoutNamespace ("node" ).AsAdmin ()
1718 )
1819
20+ g .BeforeEach (func () {
21+ isMicroShift , err := exutil .IsMicroShiftCluster (oc .AdminKubeClient ())
22+ o .Expect (err ).NotTo (o .HaveOccurred ())
23+ if isMicroShift {
24+ g .Skip ("Skipping test on MicroShift cluster" )
25+ }
26+ })
27+
1928 //author: asahay@redhat.com
2029 g .It ("[OTP] validate KUBELET_LOG_LEVEL" , func () {
2130 var kubeservice string
2231 var kublet string
2332 var err error
2433
25- isMicroShift , err := exutil .IsMicroShiftCluster (oc .AdminKubeClient ())
26- if err != nil {
27- o .Expect (err ).NotTo (o .HaveOccurred (), "error determining if running on MicroShift: %v" , err )
28- }
29- if isMicroShift {
30- g .Skip ("This test case is not supported in micoshift cluster " )
31- }
32-
3334 g .By ("Polling to check kubelet log level on ready nodes" )
3435 waitErr := wait .Poll (10 * time .Second , 1 * time .Minute , func () (bool , error ) {
3536 g .By ("Getting all node names in the cluster" )
@@ -74,4 +75,20 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
7475 }
7576 o .Expect (waitErr ).NotTo (o .HaveOccurred (), "KUBELET_LOG_LEVEL is not expected, timed out" )
7677 })
78+
79+ //author: cmaurya@redhat.com
80+ g .It ("[OTP] validate cgroupv2 is default" , func () {
81+ g .By ("1) Check cgroup version" )
82+ workerNode , err := oc .AsAdmin ().WithoutNamespace ().Run ("get" ).Args ("nodes" , "-l" , "node-role.kubernetes.io/worker" , "-o=jsonpath={.items[0].metadata.name}" ).Output ()
83+ o .Expect (err ).NotTo (o .HaveOccurred ())
84+ cgroupV , err := oc .AsAdmin ().WithoutNamespace ().Run ("debug" ).Args ("node/" + workerNode , "-ndefault" , "--" , "chroot" , "/host" , "/bin/bash" , "-c" , "stat -c %T -f /sys/fs/cgroup" ).Output ()
85+ o .Expect (err ).NotTo (o .HaveOccurred ())
86+ e2e .Logf ("cgroup version info is: [%v]\n " , cgroupV )
87+ o .Expect (strings .Contains (cgroupV , "cgroup2fs" )).Should (o .BeTrue ())
88+
89+ g .By ("2) Changing cgroup from v2 to v1 should result in error" )
90+ output , err := oc .AsAdmin ().WithoutNamespace ().Run ("patch" ).Args ("nodes.config.openshift.io" , "cluster" , "-p" , `{"spec": {"cgroupMode": "v1"}}` , "--type=merge" ).Output ()
91+ o .Expect (err ).Should (o .HaveOccurred ())
92+ o .Expect (strings .Contains (output , "Unsupported value: \" v1\" " )).Should (o .BeTrue ())
93+ })
7794})
0 commit comments