From 2721725af0d217b5cad4cadf1aa48f4a66be45ac Mon Sep 17 00:00:00 2001 From: Mike Beaumont Date: Mon, 14 Sep 2020 15:18:03 +0200 Subject: [PATCH] Wait for new server version in integration test (#2644) --- .../tests/managed/managed_nodegroup_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/integration/tests/managed/managed_nodegroup_test.go b/integration/tests/managed/managed_nodegroup_test.go index 7dbdacba01..331b37045a 100644 --- a/integration/tests/managed/managed_nodegroup_test.go +++ b/integration/tests/managed/managed_nodegroup_test.go @@ -25,6 +25,11 @@ import ( "k8s.io/client-go/tools/clientcmd" ) +const ( + k8sUpdatePollInterval = "2s" + k8sUpdatePollTimeout = "3m" +) + var params *tests.Params func init() { @@ -246,10 +251,11 @@ var _ = Describe("(Integration) Create Managed Nodegroups", func() { clientset, err := kubernetes.NewForConfig(config) Expect(err).ToNot(HaveOccurred()) - - serverVersion, err := clientset.ServerVersion() - Expect(err).ToNot(HaveOccurred()) - Expect(fmt.Sprintf("%s.%s", serverVersion.Major, strings.TrimSuffix(serverVersion.Minor, "+"))).To(Equal(nextVersion)) + Eventually(func() string { + serverVersion, err := clientset.ServerVersion() + Expect(err).ToNot(HaveOccurred()) + return fmt.Sprintf("%s.%s", serverVersion.Major, strings.TrimSuffix(serverVersion.Minor, "+")) + }, k8sUpdatePollTimeout, k8sUpdatePollInterval).Should(Equal(nextVersion)) By(fmt.Sprintf("upgrading nodegroup %s to Kubernetes version %s", initialNodeGroup, nextVersion)) cmd = params.EksctlUpgradeCmd.WithArgs(