test/e2e: Fix flaking subresource test

Avoid comparing fields that might end up changing
between two invocations of kubectl.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
Madhav Jivrajani 2023-03-15 03:42:17 +05:30
parent 9c2d28f7d5
commit 87b64744dc

View File

@ -1990,7 +1990,22 @@ metadata:
outBuiltIn := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name)
ginkgo.By(fmt.Sprintf("calling kubectl get nodes %s --subresource=status", node.Name))
outStatusSubresource := e2ekubectl.RunKubectlOrDie("", "get", "nodes", node.Name, "--subresource=status")
gomega.Expect(outBuiltIn).To(gomega.Equal(outStatusSubresource))
// 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)
})
})
})