Skip to content

Commit

Permalink
Merge pull request #36240 from ozangunalp/improve_VT_messaging_flakiness
Browse files Browse the repository at this point in the history
Improve Virtual Threads integration tests
  • Loading branch information
geoand authored Oct 2, 2023
2 parents a45cefb + eff619c commit 2c7e36f
Show file tree
Hide file tree
Showing 44 changed files with 126 additions and 962 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.junit5</groupId>
<artifactId>junit5-virtual-threads</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public CompletionStage<Void> consume(Message<Double> msg) {
assertThatItRunsOnVirtualThread();
assertThatItRunsOnADuplicatedContext();
double price = msg.getPayload();
if (price > 90.0) {
alertService.alertMessage(price);
}
alertService.alertMessage(price);
return msg.ack().thenAccept(x -> {
assertThatItRunsOnADuplicatedContext();
// While the ack always runs on event loop thread
Expand All @@ -43,9 +41,7 @@ public CompletionStage<Void> consume(Message<Double> msg) {
public void consume(double price) {
assertThatItRunsOnVirtualThread();
assertThatItRunsOnADuplicatedContext();
if (price > 90.0) {
alertService.alert(price);
}
alertService.alert(price);
}

Random r = new Random();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit5.virtual.ShouldNotPin;
import io.quarkus.test.junit5.virtual.VirtualThreadUnit;

@QuarkusTest
@QuarkusTestResource(WireMockExtension.class)
@VirtualThreadUnit
@ShouldNotPin
public class VirtualThreadTest {

public static final int EXPECTED_CALLS = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public Map<String, String> start() {
wireMockServer.stubFor(post(urlEqualTo("/price/alert-message"))
.willReturn(aResponse().withBody("ok")));

return Map.of("price-alert/mp-rest/url", wireMockServer.baseUrl());
return Map.of("quarkus.rest-client.price-alert.url", wireMockServer.baseUrl());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.junit5</groupId>
<artifactId>junit5-virtual-threads</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import io.quarkus.grpc.test.utils.VertxGRPCTestProfile;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.TestProfile;
import io.quarkus.test.junit5.virtual.ShouldNotPin;
import io.quarkus.test.junit5.virtual.VirtualThreadUnit;

@QuarkusTest
@TestProfile(VertxGRPCTestProfile.class)
@VirtualThreadUnit
@ShouldNotPin
public class VertxVirtualThreadTest extends VirtualThreadTestBase {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package io.quarkus.grpc.example.streaming;

import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit5.virtual.ShouldNotPin;
import io.quarkus.test.junit5.virtual.VirtualThreadUnit;

@QuarkusTest
@VirtualThreadUnit
@ShouldNotPin
public class VirtualThreadTest extends VirtualThreadTestBase {
}
20 changes: 7 additions & 13 deletions integration-tests/virtual-threads/jms-virtual-threads/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-messaging</artifactId>
</dependency>
<!-- JMS connector not part of the Quarkus BOM -->
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-reactive-messaging-jms</artifactId>
<version>4.9.0</version>
<version>4.10.1</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -57,6 +58,11 @@
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus.junit5</groupId>
<artifactId>junit5-virtual-threads</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand Down Expand Up @@ -144,18 +150,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Flaky test -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<!-- Flaky test -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.quarkus.it.vthreads.jms;

import static io.quarkus.it.vthreads.jms.AssertHelper.assertThatItDoesNotRunOnVirtualThread;
import static io.quarkus.it.vthreads.jms.AssertHelper.assertThatItRunsOnVirtualThread;

import java.util.Random;
Expand All @@ -27,19 +26,15 @@ public class PriceConsumer {
public CompletionStage<Void> consume(Message<Double> msg) {
assertThatItRunsOnVirtualThread();
double price = msg.getPayload();
if (price > 90.0) {
alertService.alertMessage(price);
}
return msg.ack().thenAccept(x -> assertThatItDoesNotRunOnVirtualThread());
alertService.alertMessage(price);
return msg.ack();
}

@Incoming("prices")
@RunOnVirtualThread
public void consume(double price) {
assertThatItRunsOnVirtualThread();
if (price > 90.0) {
alertService.alert(price);
}
alertService.alert(price);
}

Random r = new Random();
Expand Down

This file was deleted.

Loading

0 comments on commit 2c7e36f

Please sign in to comment.