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 2022/08/29 14:48:20 UTC
[camel-quarkus] branch main updated: master: fix itests harness in native mode
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 e6c2c9f3eb master: fix itests harness in native mode
e6c2c9f3eb is described below
commit e6c2c9f3eb6d54c0e822686910c05d46547db5c4
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon Aug 29 13:38:18 2022 +0200
master: fix itests harness in native mode
---
.../camel/quarkus/component/master/it/MasterIT.java | 3 ---
.../camel/quarkus/component/master/it/MasterTest.java | 17 ++++++++++++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterIT.java b/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterIT.java
index a22caa305b..261cd8a06a 100644
--- a/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterIT.java
+++ b/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterIT.java
@@ -17,10 +17,7 @@
package org.apache.camel.quarkus.component.master.it;
import io.quarkus.test.junit.QuarkusIntegrationTest;
-import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
-// https://github.com/apache/camel-quarkus/issues/2660
-@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
@QuarkusIntegrationTest
class MasterIT extends MasterTest {
diff --git a/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterTest.java b/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterTest.java
index ef48bda2d2..e1cad60ec5 100644
--- a/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterTest.java
+++ b/integration-tests/master/src/test/java/org/apache/camel/quarkus/component/master/it/MasterTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.quarkus.component.master.it;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
@@ -26,14 +25,23 @@ import java.util.concurrent.TimeUnit;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import org.apache.camel.quarkus.test.support.process.QuarkusProcessExecutor;
+import org.apache.commons.io.FileUtils;
import org.awaitility.Awaitility;
-import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.zeroturnaround.exec.StartedProcess;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.emptyString;
+
@QuarkusTest
class MasterTest {
+ @BeforeAll
+ public static void deleteClusterFiles() throws IOException {
+ FileUtils.deleteDirectory(Paths.get("target/cluster/").toFile());
+ }
+
@Test
public void testFailover() throws IOException {
// Start secondary application process
@@ -50,7 +58,7 @@ class MasterTest {
});
// Verify the follower hasn't took leader role
- Assertions.assertTrue(readLeaderFile("follower").isEmpty());
+ assertThat(readLeaderFile("follower"), emptyString());
// Stop camel to trigger failover
RestAssured.given()
@@ -92,8 +100,7 @@ class MasterTest {
private String readLeaderFile(String fileName) throws IOException {
Path path = Paths.get(String.format("target/cluster/%s.txt", fileName));
if (path.toFile().exists()) {
- byte[] bytes = Files.readAllBytes(path);
- return new String(bytes, StandardCharsets.UTF_8);
+ return FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8);
}
return "";
}