@@ -17,20 +17,21 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
1717 oc = exutil .NewCLIWithoutNamespace ("node" )
1818 )
1919
20+ // Skip all tests on MicroShift clusters as MachineConfig resources are not available
21+ g .BeforeEach (func () {
22+ isMicroShift , err := exutil .IsMicroShiftCluster (oc .AdminKubeClient ())
23+ o .Expect (err ).NotTo (o .HaveOccurred ())
24+ if isMicroShift {
25+ g .Skip ("Skipping test on MicroShift cluster - MachineConfig resources are not available" )
26+ }
27+ })
28+
2029 //author: asahay@redhat.com
2130 g .It ("[OTP] validate KUBELET_LOG_LEVEL" , func () {
2231 var kubeservice string
2332 var kubelet string
2433 var err error
2534
26- isMicroShift , err := exutil .IsMicroShiftCluster (oc .AdminKubeClient ())
27- if err != nil {
28- o .Expect (err ).NotTo (o .HaveOccurred (), "error determining if running on MicroShift: %v" , err )
29- }
30- if isMicroShift {
31- g .Skip ("This test case is not supported in micoshift cluster " )
32- }
33-
3435 g .By ("Polling to check kubelet log level on ready nodes" )
3536 waitErr := wait .Poll (10 * time .Second , 1 * time .Minute , func () (bool , error ) {
3637 g .By ("Getting all node names in the cluster" )
@@ -75,4 +76,23 @@ var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] Kubelet, CRI-O, CPU manager",
7576 }
7677 o .Expect (waitErr ).NotTo (o .HaveOccurred (), "KUBELET_LOG_LEVEL is not expected, timed out" )
7778 })
79+
80+ //author: cmaurya@redhat.com
81+ g .It ("[OTP] validate cgroupv2 is default" , func () {
82+ g .By ("Get a Ready worker node and check cgroup version" )
83+ workerNode , err := oc .AsAdmin ().WithoutNamespace ().Run ("get" ).Args ("nodes" , "-l" , "node-role.kubernetes.io/worker" , "-o=jsonpath={.items[0].metadata.name}" ).Output ()
84+ o .Expect (err ).NotTo (o .HaveOccurred ())
85+ nodeStatus , err := oc .AsAdmin ().Run ("get" ).Args ("nodes" , workerNode , "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}" ).Output ()
86+ o .Expect (err ).NotTo (o .HaveOccurred ())
87+ o .Expect (nodeStatus ).To (o .Equal ("True" ), "Worker node %s is not Ready" , workerNode )
88+ cgroupV , err := nodeutils .ExecOnNodeWithChroot (oc , workerNode , "/bin/bash" , "-c" , "stat -c %T -f /sys/fs/cgroup" )
89+ o .Expect (err ).NotTo (o .HaveOccurred ())
90+ e2e .Logf ("cgroup version info is: [%v]\n " , cgroupV )
91+ o .Expect (cgroupV ).To (o .ContainSubstring ("cgroup2fs" ))
92+
93+ g .By ("Changing cgroup from v2 to v1 should result in error" )
94+ output , err := oc .AsAdmin ().WithoutNamespace ().Run ("patch" ).Args ("nodes.config.openshift.io" , "cluster" , "-p" , `{"spec": {"cgroupMode": "v1"}}` , "--type=merge" ).Output ()
95+ o .Expect (err ).Should (o .HaveOccurred ())
96+ o .Expect (output ).To (o .ContainSubstring ("spec.cgroupMode: Unsupported value: \" v1\" : supported values: \" v2\" , \" \" " ))
97+ })
7898})
0 commit comments