Merge pull request #122240 from aravindhp/nlq-only-select-linux-nodes

e2e: only select linux nodes for NodeLogQuery tests
This commit is contained in:
Kubernetes Prow Robot 2024-01-03 20:33:24 +01:00 committed by GitHub
commit 2c96352cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -464,8 +464,13 @@ var _ = SIGDescribe("kubelet", func() {
nodes, err := e2enode.GetReadyNodesIncludingTainted(ctx, c)
framework.ExpectNoError(err)
if len(nodes.Items) == 0 {
framework.Fail("Expected at least one node to be present")
}
linuxNodes := getLinuxNodes(nodes)
if len(linuxNodes.Items) == 0 {
framework.Fail("Expected at least one Linux node to be present")
}
linuxNodeName = nodes.Items[0].Name
})
@ -579,6 +584,23 @@ var _ = SIGDescribe("kubelet", func() {
})
})
func getLinuxNodes(nodes *v1.NodeList) *v1.NodeList {
e2enode.Filter(nodes, func(node v1.Node) bool {
return isLinuxNode(&node)
})
return nodes
}
func isLinuxNode(node *v1.Node) bool {
if node == nil {
return false
}
if os, found := node.Labels[v1.LabelOSStable]; found {
return (os == "linux")
}
return false
}
func runKubectlCommand(cmd *exec.Cmd) (result string) {
stdout, stderr, err := framework.StartCmdAndStreamOutput(cmd)
var buf bytes.Buffer