You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/03/24 12:36:54 UTC

[camel-k] 07/07: fix(e2e): Refresh test client to account for new CRDs

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

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

commit 5f8bd10de70a5e8e7b1179f1d8521e2263fd678e
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Mar 24 10:06:45 2021 +0100

    fix(e2e): Refresh test client to account for new CRDs
---
 e2e/support/test_support.go          | 29 +++++++++--------------------
 e2e/upgrade/upgrade_operator_test.go |  4 ++++
 2 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index f9a6f5c..1b45266 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -93,6 +93,15 @@ func TestClient() client.Client {
 	return testClient
 }
 
+func SyncClient() client.Client {
+	var err error
+	testClient, err = NewTestClient()
+	if err != nil {
+		panic(err)
+	}
+	return testClient
+}
+
 // KamelHooks contains hooks useful to add option to kamel commands at runtime
 var KamelHooks []func([]string) []string
 
@@ -550,15 +559,6 @@ func IntegrationKit(ns string, name string) func() string {
 	}
 }
 
-func SetIntegrationVersion(ns string, name string, version string) error {
-	it := Integration(ns, name)()
-	if it == nil {
-		return fmt.Errorf("no integration named %s found", name)
-	}
-	it.Status.Version = version
-	return TestClient().Status().Update(TestContext, it)
-}
-
 func UpdateIntegration(ns string, name string, upd func(it *v1.Integration)) error {
 	it := Integration(ns, name)()
 	if it == nil {
@@ -596,17 +596,6 @@ func KitsWithVersion(ns string, version string) func() int {
 	}
 }
 
-func SetAllKitsVersion(ns string, version string) error {
-	for _, k := range Kits(ns)() {
-		kit := k
-		kit.Status.Version = version
-		if err := TestClient().Status().Update(TestContext, &kit); err != nil {
-			return err
-		}
-	}
-	return nil
-}
-
 func OperatorImage(ns string) func() string {
 	return func() string {
 		pod := OperatorPod(ns)()
diff --git a/e2e/upgrade/upgrade_operator_test.go b/e2e/upgrade/upgrade_operator_test.go
index 13b0960..9510846 100644
--- a/e2e/upgrade/upgrade_operator_test.go
+++ b/e2e/upgrade/upgrade_operator_test.go
@@ -48,6 +48,10 @@ func TestOperatorUpgrade(t *testing.T) {
 
 		// Check the operator pod is running
 		Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(v1.PodRunning))
+
+		// Refresh the test client to account for the newly installed CRDs
+		SyncClient()
+
 		// Check the IntegrationPlatform has been reconciled
 		Eventually(PlatformVersion(ns), TestTimeoutMedium).Should(Equal(version))