Skip to content

Commit

Permalink
Merge pull request #35996 from gsmet/better-maven-its
Browse files Browse the repository at this point in the history
Make Maven ITs less fragile
  • Loading branch information
gsmet authored Oct 25, 2023
2 parents 8cb1e33 + 5bec8af commit 12ef71e
Show file tree
Hide file tree
Showing 81 changed files with 933 additions and 425 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void doTest(String projectName, String profile) throws MavenInvocationException,
.execute(Arrays.asList("package", "-B",
"-D" + profile), Collections.emptyMap());

await().atMost(1, TimeUnit.MINUTES)
await().atMost(3, TimeUnit.MINUTES)
.until(() -> packageInvocationResult.getProcess() != null && !packageInvocationResult.getProcess().isAlive());
assertThat(packageInvocation.log()).containsIgnoringCase("BUILD SUCCESS");

Expand All @@ -35,7 +35,7 @@ void doTest(String projectName, String profile) throws MavenInvocationException,
.execute(Arrays.asList("failsafe:integration-test", "-B",
"-D" + profile), Collections.emptyMap());

await().atMost(1, TimeUnit.MINUTES)
await().atMost(3, TimeUnit.MINUTES)
.until(() -> integrationTestsInvocationResult.getProcess() != null
&& !integrationTestsInvocationResult.getProcess().isAlive());
assertThat(integrationTestsInvocation.log()).containsIgnoringCase("BUILD SUCCESS");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void testThatTheApplicationIsReloadedOnJavaChange()
// Wait until we get "uuid"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/hello").contains(uuid));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello").contains(uuid));

await()
.pollDelay(1, TimeUnit.SECONDS)
Expand All @@ -52,7 +53,8 @@ public void testThatTheApplicationIsReloadedOnJavaChange()
// Wait until we get "carambar"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/hello").contains("carambar"));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello").contains("carambar"));

//also verify that the dev ui console is disabled
devModeClient.getHttpResponse("/q/dev-v1", 404, 10, TimeUnit.SECONDS);
Expand Down Expand Up @@ -87,7 +89,8 @@ public void testThatTheApplicationIsReloadedOnNewResource() throws MavenInvocati
// Wait until we get "bar"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/foo").contains("bar"));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/foo").contains("bar"));
}

@Test
Expand Down Expand Up @@ -119,7 +122,7 @@ public void testThatTheApplicationIsReloadedOnConfigChange() throws MavenInvocat
// Wait until we get "uuid"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES)
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello/greeting").contains(uuid));
}

Expand All @@ -137,23 +140,23 @@ public void testThatNewResourcesAreServed() throws MavenInvocationException, IOE
"UTF-8");
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES)
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/lorem.txt").contains("Lorem ipsum"));

// Update the resource
String uuid = UUID.randomUUID().toString();
FileUtils.write(source, uuid, "UTF-8");
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES)
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/lorem.txt").contains(uuid));

// Delete the resource
//TODO: not supported yet in remote dev
// source.delete();
// await()
// .pollDelay(1, TimeUnit.SECONDS)
// .atMost(1, TimeUnit.MINUTES)
// .atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
// .until(() -> getHttpResponse("/lorem.txt", 404));
}

Expand All @@ -172,7 +175,7 @@ public void testThatApplicationRecoversCompilationIssue() throws MavenInvocation
AtomicReference<String> last = new AtomicReference<>();
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> {
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES).until(() -> {
String content = devModeClient.getHttpResponse("/app/hello", true);
last.set(content);
return content.contains(uuid);
Expand All @@ -191,7 +194,8 @@ public void testThatApplicationRecoversCompilationIssue() throws MavenInvocation
// Wait until we get "uuid"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/hello").contains("carambar"));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello").contains("carambar"));
}

@Test
Expand Down Expand Up @@ -224,7 +228,8 @@ public void testThatNewBeanAreDiscovered() throws IOException, MavenInvocationEx
// Wait until we get "uuid"
await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/hello").contains("message"));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello").contains("message"));

await()
.pollDelay(1, TimeUnit.SECONDS)
Expand All @@ -235,7 +240,8 @@ public void testThatNewBeanAreDiscovered() throws IOException, MavenInvocationEx

await()
.pollDelay(1, TimeUnit.SECONDS)
.atMost(1, TimeUnit.MINUTES).until(() -> devModeClient.getHttpResponse("/app/hello").contains("foobarbaz"));
.atMost(TestUtils.getDefaultTimeout(), TimeUnit.MINUTES)
.until(() -> devModeClient.getHttpResponse("/app/hello").contains("foobarbaz"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.quarkus.maven.it;

import io.smallrye.common.os.OS;

final class TestUtils {

private static final long DEFAULT_TIMEOUT = OS.current() == OS.WINDOWS ? 3L : 1L;

private TestUtils() {
}

static long getDefaultTimeout() {
return DEFAULT_TIMEOUT;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<groupId>org.acme</groupId>
Expand All @@ -12,24 +13,31 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<surefire-plugin.version>${version.surefire.plugin}</surefire-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
</properties>
<modules>
<module>library</module>
<module>runner</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>\${quarkus-plugin.version}</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>\${quarkus-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>\${compiler-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<maven.compiler.source>11</maven.compiler.source>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -38,6 +39,10 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>\${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus.profile>bar</quarkus.profile>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<maven.compiler.source>11</maven.compiler.source>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -36,6 +37,10 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>\${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus.profile>foo</quarkus.profile>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<maven.compiler.source>11</maven.compiler.source>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -36,6 +37,10 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>\${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>@project.version@</quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>@project.version@</quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.version>@project.version@</quarkus.platform.version>
<quarkus-plugin.version>@project.version@</quarkus-plugin.version>
<surefire-plugin.version>3.1.2</surefire-plugin.version>
<surefire-plugin.version>${version.surefire.plugin}</surefire-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<modules>
<module>acme-ext</module>
Expand All @@ -24,13 +25,19 @@
</modules>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>\${quarkus-plugin.version}</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>\${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>\${quarkus-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>@project.version@</quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
</properties>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>@project.version@</quarkus.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
<compiler-plugin.version>${compiler-plugin.version}</compiler-plugin.version>
</properties>

<modules>
Expand Down
Loading

0 comments on commit 12ef71e

Please sign in to comment.