You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/07/13 06:25:22 UTC

[camel-k] branch main updated: Find deployment via integration label

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 174f20aa2 Find deployment via integration label
174f20aa2 is described below

commit 174f20aa2fda6b38c6025b3a1e49cf3808736c34
Author: Lucie Krejcirova <lf...@redhat.com>
AuthorDate: Wed Jul 12 13:13:11 2023 +0200

    Find deployment via integration label
---
 e2e/common/traits/openapi_test.go |  2 +-
 e2e/support/test_support.go       | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/e2e/common/traits/openapi_test.go b/e2e/common/traits/openapi_test.go
index 6a371a40b..f1c90ebf6 100644
--- a/e2e/common/traits/openapi_test.go
+++ b/e2e/common/traits/openapi_test.go
@@ -51,7 +51,7 @@ func TestOpenAPI(t *testing.T) {
 
 	Eventually(IntegrationPodPhase(ns, "petstore"), TestTimeoutLong).
 		Should(Equal(corev1.PodRunning))
-	Eventually(Deployment(ns, "petstore"), TestTimeoutLong).
+	Eventually(DeploymentWithIntegrationLabel(ns, "petstore"), TestTimeoutLong).
 		Should(Not(BeNil()))
 
 	Eventually(IntegrationLogs(ns, "petstore"), TestTimeoutMedium).
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 52d034a15..ae93dff57 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1551,6 +1551,26 @@ func KnativeService(ns string, name string) func() *servingv1.Service {
 		return &answer
 	}
 }
+func DeploymentWithIntegrationLabel(ns string, label string) func() *appsv1.Deployment {
+	return func() *appsv1.Deployment {
+		lst := appsv1.DeploymentList{
+			TypeMeta: metav1.TypeMeta{
+				Kind:       "Deployment",
+				APIVersion: appsv1.SchemeGroupVersion.String(),
+			},
+		}
+		if err := TestClient().List(TestContext, &lst, ctrl.InNamespace(ns), ctrl.MatchingLabels{v1.IntegrationLabel: label}); err != nil && k8serrors.IsNotFound(err) {
+			return nil
+		} else if err != nil {
+			log.Errorf(err, "Error while retrieving deployment %s", label)
+			return nil
+		}
+		if len(lst.Items) == 0 {
+			return nil
+		}
+		return &lst.Items[0]
+	}
+}
 
 func Deployment(ns string, name string) func() *appsv1.Deployment {
 	return func() *appsv1.Deployment {