Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/e2e: Improve kubectl subresource e2e test #116639

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 11 additions & 18 deletions test/e2e/kubectl/kubectl.go
Expand Up @@ -2048,26 +2048,19 @@ metadata:
framework.ExpectNoError(err)
gomega.Expect(nodes.Items).ToNot(gomega.BeEmpty())
node := nodes.Items[0]
// Avoid comparing values of fields that might end up
// changing between the two invocations of kubectl. We
// compare the name and version fields.
ginkgo.By(fmt.Sprintf("calling kubectl get nodes %s", node.Name))
outBuiltIn := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name)
outBuiltIn := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name,
"--output=jsonpath='{.metadata.name}{.status.nodeInfo.kubeletVersion}'",
)
ginkgo.By(fmt.Sprintf("calling kubectl get nodes %s --subresource=status", node.Name))
outStatusSubresource := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name, "--subresource=status")
// Avoid comparing values of fields that might end up
// changing between the two invocations of kubectl.
requiredOutput := [][]string{
{"NAME"},
{"STATUS"},
{"ROLES"},
{"AGE"},
{"VERSION"},
{node.Name}, // check for NAME
{""}, // avoid comparing STATUS
{""}, // avoid comparing ROLES
{""}, // avoid comparing AGE
{node.Status.NodeInfo.KubeletVersion}, // check for VERSION
}
checkOutput(outBuiltIn, requiredOutput)
checkOutput(outStatusSubresource, requiredOutput)
outStatusSubresource := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name,
"--output=jsonpath='{.metadata.name}{.status.nodeInfo.kubeletVersion}'",
"--subresource=status",
)
gomega.Expect(outBuiltIn).To(gomega.Equal(outStatusSubresource))
})
})
})
Expand Down