You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2023/01/26 13:31:36 UTC

[camel-quarkus] branch main updated: fix the master-openshift itest flakiness #4387

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 99d194d21c fix the master-openshift itest flakiness #4387
99d194d21c is described below

commit 99d194d21c52fd3958e258d8061ddf08340bf2ee
Author: aldettinger <al...@gmail.com>
AuthorDate: Thu Jan 26 11:25:22 2023 +0100

    fix the master-openshift itest flakiness #4387
---
 .../component/master/it/MasterOpenShiftIT.java        |  2 --
 .../component/master/it/MasterOpenShiftTest.java      | 19 +++++++++----------
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftIT.java b/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftIT.java
index d30fd37682..901a5fa025 100644
--- a/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftIT.java
+++ b/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftIT.java
@@ -17,10 +17,8 @@
 package org.apache.camel.quarkus.component.master.it;
 
 import io.quarkus.test.junit.QuarkusIntegrationTest;
-import org.junit.jupiter.api.Disabled;
 
 @QuarkusIntegrationTest
-@Disabled("https://github.com/apache/camel-quarkus/issues/4387")
 class MasterOpenShiftIT extends MasterOpenShiftTest {
 
 }
diff --git a/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftTest.java b/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftTest.java
index 14df617043..73431d68a3 100644
--- a/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftTest.java
+++ b/integration-tests/master-openshift/src/test/java/org/apache/camel/quarkus/component/master/it/MasterOpenShiftTest.java
@@ -36,7 +36,6 @@ import org.awaitility.Awaitility;
 import org.eclipse.microprofile.config.Config;
 import org.eclipse.microprofile.config.ConfigProvider;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.DisabledOnOs;
 import org.junit.jupiter.api.condition.OS;
@@ -48,7 +47,6 @@ import static org.hamcrest.Matchers.emptyString;
 
 @QuarkusTestResource(MasterOpenShiftTestResource.class)
 @QuarkusTest
-@Disabled("https://github.com/apache/camel-quarkus/issues/4387")
 class MasterOpenShiftTest {
 
     @OpenShiftTestServer
@@ -78,11 +76,8 @@ class MasterOpenShiftTest {
 
         // Start secondary application process faking KubernetesClusterService so it assumes being run from a pod named follower
         Consumer<ProcessExecutor> customizer = pe -> pe.environment("HOSTNAME", "follower");
-        QuarkusProcessExecutor quarkusProcessExecutor = new QuarkusProcessExecutor(customizer, jvmArgs.toArray(String[]::new));
-        StartedProcess process = quarkusProcessExecutor.start();
-
-        // Wait until the process is fully initialized
-        awaitStartup(quarkusProcessExecutor);
+        QuarkusProcessExecutor followerProcessExecutor = new QuarkusProcessExecutor(customizer, jvmArgs.toArray(String[]::new));
+        StartedProcess followerProcess = null;
 
         try {
             // Verify that this process is the cluster leader
@@ -90,7 +85,11 @@ class MasterOpenShiftTest {
                 return readLeaderFile("leader").equals("leader");
             });
 
-            // Verify the follower hasn't took leader role
+            // Start the follower process and wait until fully initialized
+            followerProcess = followerProcessExecutor.start();
+            awaitStartup(followerProcessExecutor);
+
+            // Verify the follower hasn't took leader role yet
             assertThat(readLeaderFile("follower"), emptyString());
 
             // Stop camel and delete the lease mock to trigger fail-over
@@ -103,8 +102,8 @@ class MasterOpenShiftTest {
                 return readLeaderFile("follower").equals("leader");
             });
         } finally {
-            if (process != null && process.getProcess().isAlive()) {
-                process.getProcess().destroy();
+            if (followerProcess != null && followerProcess.getProcess().isAlive()) {
+                followerProcess.getProcess().destroy();
             }
         }
     }