Skip to content

Commit

Permalink
Merge pull request kubernetes#116639 from MadhavJivrajani/improve-e2e…
Browse files Browse the repository at this point in the history
…-subresource-test

test/e2e: Improve kubectl subresource e2e test
  • Loading branch information
k8s-ci-robot committed Mar 15, 2023
2 parents 8decaf3 + 88b498f commit 409d055
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions test/e2e/kubectl/kubectl.go
Original file line number Diff line number Diff line change
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

0 comments on commit 409d055

Please sign in to comment.