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

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

commit 57a9dbbb637358823a6dbb4a4d8b0134874e963e
Author: Christoph Deppisch <cdeppi...@redhat.com>
AuthorDate: Wed Feb 21 14:27:54 2024 +0100

    fix(e2e): Wait for IntegrationPlatform to become ready
    
    - Avoid running integrations when platform is not ready
    - Stabilize tests
---
 e2e/advanced/debug_test.go             | 14 +++++++++-----
 e2e/advanced/dump_test.go              |  3 +++
 e2e/advanced/environment_test.go       |  2 ++
 e2e/advanced/incremental_build_test.go |  1 +
 e2e/advanced/operator_metrics_test.go  |  2 ++
 e2e/advanced/promote_test.go           |  1 +
 e2e/advanced/reset_test.go             |  3 +++
 e2e/advanced/synthetic_test.go         |  1 +
 8 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/e2e/advanced/debug_test.go b/e2e/advanced/debug_test.go
index 2cb03288a..1a0fb8bc8 100644
--- a/e2e/advanced/debug_test.go
+++ b/e2e/advanced/debug_test.go
@@ -29,9 +29,11 @@ import (
        "testing"
        "time"
 
+       corev1 "k8s.io/api/core/v1"
+
        . "github.com/apache/camel-k/v2/e2e/support"
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        . "github.com/onsi/gomega"
-       v1 "k8s.io/api/core/v1"
 )
 
 func TestKamelCLIDebug(t *testing.T) {
@@ -42,9 +44,11 @@ func TestKamelCLIDebug(t *testing.T) {
                Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
 
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
                t.Run("debug local default port check", func(t *testing.T) {
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
                        Expect(portIsInUse("127.0.0.1", "5005")()).To(BeFalse())
 
                        debugTestContext, cancel := 
context.WithCancel(TestContext)
@@ -57,7 +61,7 @@ func TestKamelCLIDebug(t *testing.T) {
 
                t.Run("debug local port check", func(t *testing.T) {
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
                        Expect(portIsInUse("127.0.0.1", "5006")()).To(BeFalse())
 
                        debugTestContext, cancel := 
context.WithCancel(TestContext)
@@ -70,7 +74,7 @@ func TestKamelCLIDebug(t *testing.T) {
 
                t.Run("debug logs check", func(t *testing.T) {
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
 
                        debugTestContext, cancel := 
context.WithCancel(TestContext)
                        defer cancelAndWait(cancel)
@@ -82,7 +86,7 @@ func TestKamelCLIDebug(t *testing.T) {
 
                t.Run("Pod config test", func(t *testing.T) {
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
-                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(v1.PodRunning))
+                       Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutMedium).Should(Equal(corev1.PodRunning))
 
                        debugTestContext, cancel := 
context.WithCancel(TestContext)
                        defer cancelAndWait(cancel)
diff --git a/e2e/advanced/dump_test.go b/e2e/advanced/dump_test.go
index 95e6fe629..587c8116d 100644
--- a/e2e/advanced/dump_test.go
+++ b/e2e/advanced/dump_test.go
@@ -24,6 +24,7 @@ package advanced
 
 import (
        "fmt"
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        "testing"
 
        . "github.com/onsi/gomega"
@@ -48,6 +49,8 @@ func TestKamelCLIDump(t *testing.T) {
                        operatorID := fmt.Sprintf("camel-k-%s", ns)
                        Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                        Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+                       Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml").Execute()).To(Succeed())
                        Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
                        Eventually(IntegrationLogs(ns, 
"yaml")).Should(ContainSubstring("Magicstring!"))
diff --git a/e2e/advanced/environment_test.go b/e2e/advanced/environment_test.go
index 6ecfb717a..4bfffb429 100644
--- a/e2e/advanced/environment_test.go
+++ b/e2e/advanced/environment_test.go
@@ -71,6 +71,8 @@ func TestEnvironmentTrait(t *testing.T) {
                        "--operator-env-vars", 
"NO_PROXY="+strings.Join(noProxy, ","),
                ).Execute()).To(Succeed())
 
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
                t.Run("Run integration with default environment", func(t 
*testing.T) {
                        name := RandomizedSuffixName("java-default")
                        Expect(KamelRunWithID(operatorID, ns, "--name", name, 
"files/Java.java").Execute()).To(Succeed())
diff --git a/e2e/advanced/incremental_build_test.go 
b/e2e/advanced/incremental_build_test.go
index 81c23f0d4..dc7bcf16e 100644
--- a/e2e/advanced/incremental_build_test.go
+++ b/e2e/advanced/incremental_build_test.go
@@ -40,6 +40,7 @@ func TestRunIncrementalBuildRoutine(t *testing.T) {
                operatorID := "camel-k-incremental-build"
                Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
                name := RandomizedSuffixName("java")
                Expect(KamelRunWithID(operatorID, ns, "files/Java.java",
diff --git a/e2e/advanced/operator_metrics_test.go 
b/e2e/advanced/operator_metrics_test.go
index 8dfade9b0..182812577 100644
--- a/e2e/advanced/operator_metrics_test.go
+++ b/e2e/advanced/operator_metrics_test.go
@@ -63,6 +63,8 @@ func TestMetrics(t *testing.T) {
                operatorID := "camel-k-metrics"
                Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                Expect(KamelInstallWithID(operatorID, ns, "--log-level", 
"debug").Execute()).To(Succeed())
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
                Expect(KamelRunWithID(operatorID, ns, "files/Java.java",
                        "--name", name,
                        "-t", "prometheus.enabled=true",
diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go
index d52db9118..15580920a 100644
--- a/e2e/advanced/promote_test.go
+++ b/e2e/advanced/promote_test.go
@@ -41,6 +41,7 @@ func TestKamelCLIPromote(t *testing.T) {
                operatorDevID := "camel-k-cli-promote-dev"
                Expect(CopyCamelCatalog(nsDev, operatorDevID)).To(Succeed())
                Expect(KamelInstallWithID(operatorDevID, 
nsDev).Execute()).To(Succeed())
+               Eventually(SelectedPlatformPhase(nsDev, operatorDevID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
                // Dev content configmap
                var cmData = make(map[string]string)
diff --git a/e2e/advanced/reset_test.go b/e2e/advanced/reset_test.go
index 2e4dd1d48..3ab367410 100644
--- a/e2e/advanced/reset_test.go
+++ b/e2e/advanced/reset_test.go
@@ -29,6 +29,7 @@ import (
        corev1 "k8s.io/api/core/v1"
 
        . "github.com/apache/camel-k/v2/e2e/support"
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 )
 
 func TestKamelReset(t *testing.T) {
@@ -37,6 +38,8 @@ func TestKamelReset(t *testing.T) {
                Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
 
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
+
                t.Run("Reset the whole platform", func(t *testing.T) {
                        name := RandomizedSuffixName("yaml1")
                        Expect(KamelRunWithID(operatorID, ns, 
"files/yaml.yaml", "--name", name).Execute()).To(Succeed())
diff --git a/e2e/advanced/synthetic_test.go b/e2e/advanced/synthetic_test.go
index cec7fdeb7..67539964f 100644
--- a/e2e/advanced/synthetic_test.go
+++ b/e2e/advanced/synthetic_test.go
@@ -41,6 +41,7 @@ func TestSyntheticIntegrationOff(t *testing.T) {
                operatorID := "camel-k-synthetic-env-off"
                Expect(CopyCamelCatalog(ns, operatorID)).To(Succeed())
                Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+               Eventually(SelectedPlatformPhase(ns, operatorID), 
TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
 
                // Run the external deployment
                ExpectExecSucceed(t, Kubectl("apply", "-f", 
"files/deploy.yaml", "-n", ns))

Reply via email to