This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 8a719066009fae5cade8001958ab3ec6708bc1e6
Author: Nicola Ferraro <ni.ferr...@gmail.com>
AuthorDate: Thu Dec 19 00:31:20 2019 +0100

    Fix #921: fix flacky test
---
 e2e/test_support.go | 14 ++++++++------
 e2e/upgrade_test.go |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/e2e/test_support.go b/e2e/test_support.go
index b8852bd..a05066d 100644
--- a/e2e/test_support.go
+++ b/e2e/test_support.go
@@ -422,13 +422,15 @@ func deletePlatform(ns string) func() bool {
        }
 }
 
-func setPlatformVersion(ns string, version string) error {
-       p := platform(ns)()
-       if p == nil {
-               return errors.New("no platform found")
+func setPlatformVersion(ns string, version string) func()error {
+       return func() error {
+               p := platform(ns)()
+               if p == nil {
+                       return errors.New("no platform found")
+               }
+               p.Status.Version = version
+               return testClient.Status().Update(testContext, p)
        }
-       p.Status.Version = version
-       return testClient.Status().Update(testContext, p)
 }
 
 func platformVersion(ns string) func() string {
diff --git a/e2e/upgrade_test.go b/e2e/upgrade_test.go
index 2017670..ede2b5d 100644
--- a/e2e/upgrade_test.go
+++ b/e2e/upgrade_test.go
@@ -40,7 +40,7 @@ func TestPlatformUpgrade(t *testing.T) {
                Eventually(operatorPod(ns)).Should(BeNil())
 
                // Change the version to an older one
-               Expect(setPlatformVersion(ns, "an.older.one")).Should(BeNil())
+               Eventually(setPlatformVersion(ns, 
"an.older.one")).Should(BeNil())
                Eventually(platformVersion(ns)).Should(Equal("an.older.one"))
 
                // Scale the operator up

Reply via email to