Skip to content

Commit bc75f72

Browse files
committed
Automation of OCP-55033
1 parent 2d22e87 commit bc75f72

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed

test/extended/node/OWNERS

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
reviewers:
2+
- lyman9966
3+
- asahay19
4+
- cpmeadors
5+
- sairameshv
6+
- mrunalp
7+
- BhargaviGudi
8+
approvers:
9+
- lyman9966
10+
- cpmeadors
11+
- sairameshv
12+
- mrunalp

test/extended/node/node.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package node
2+
3+
import (
4+
g "github.com/onsi/ginkgo/v2"
5+
exutil "github.com/openshift/origin/test/extended/util"
6+
//e2e "k8s.io/kubernetes/test/e2e/framework"
7+
)
8+
9+
var _ = g.Describe("[sig-node] NODE initContainer policy,volume,readines,quota", func() {
10+
var (
11+
oc = exutil.NewCLIWithoutNamespace("node").AsAdmin()
12+
)
13+
14+
//author: asahay@redhat.com
15+
g.It("check KUBELET_LOG_LEVEL is 2", func() {
16+
g.By("check Kubelet Log Level\n")
17+
assertKubeletLogLevel(oc)
18+
})
19+
})

test/extended/node/node_utils.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package node
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
"time"
7+
8+
o "github.com/onsi/gomega"
9+
exutil "github.com/openshift/origin/test/extended/util"
10+
compat_otp "github.com/openshift/origin/test/extended/util/compat_otp"
11+
"k8s.io/apimachinery/pkg/util/wait"
12+
e2e "k8s.io/kubernetes/test/e2e/framework"
13+
)
14+
15+
func assertKubeletLogLevel(oc *exutil.CLI) {
16+
var kubeservice string
17+
var kublet string
18+
var err error
19+
waitErr := wait.Poll(10*time.Second, 1*time.Minute, func() (bool, error) {
20+
nodeName, nodeErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", "-o=jsonpath={.items[*].metadata.name}").Output()
21+
o.Expect(nodeErr).NotTo(o.HaveOccurred())
22+
e2e.Logf("\nNode Names are %v", nodeName)
23+
nodes := strings.Fields(nodeName)
24+
25+
for _, node := range nodes {
26+
nodeStatus, statusErr := oc.AsAdmin().WithoutNamespace().Run("get").Args("nodes", node, "-o=jsonpath={.status.conditions[?(@.type=='Ready')].status}").Output()
27+
o.Expect(statusErr).NotTo(o.HaveOccurred())
28+
e2e.Logf("\nNode %s Status is %s\n", node, nodeStatus)
29+
30+
if nodeStatus == "True" {
31+
kubeservice, err = compat_otp.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "systemctl show kubelet.service | grep KUBELET_LOG_LEVEL")
32+
o.Expect(err).NotTo(o.HaveOccurred())
33+
kublet, err = compat_otp.DebugNodeWithChroot(oc, node, "/bin/bash", "-c", "ps aux | grep kubelet")
34+
o.Expect(err).NotTo(o.HaveOccurred())
35+
36+
if strings.Contains(string(kubeservice), "KUBELET_LOG_LEVEL") && strings.Contains(string(kublet), "--v=2") {
37+
e2e.Logf(" KUBELET_LOG_LEVEL is 2. \n")
38+
return true, nil
39+
} else {
40+
e2e.Logf(" KUBELET_LOG_LEVEL is not 2. \n")
41+
return false, nil
42+
}
43+
} else {
44+
e2e.Logf("\n NODES ARE NOT READY\n ")
45+
}
46+
}
47+
return false, nil
48+
})
49+
if waitErr != nil {
50+
e2e.Logf("Kubelet Log level is:\n %v\n", kubeservice)
51+
e2e.Logf("Running Proccess of kubelet are:\n %v\n", kublet)
52+
AssertWaitPollNoErr(waitErr, "KUBELET_LOG_LEVEL is not expected")
53+
}
54+
}
55+
56+
func AssertWaitPollNoErr(err error, desc string) {
57+
if err == nil {
58+
return
59+
}
60+
panic(fmt.Sprintf("Timed out waiting for %q: %v", desc, err))
61+
}

0 commit comments

Comments
 (0)