forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add issue quarkusio#31422 reproducer.
- Loading branch information
Showing
8 changed files
with
163 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...-tests/grpc-streaming/src/test/java/io/quarkus/grpc/example/streaming/LongStreamTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.quarkus.grpc.example.streaming; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class LongStreamTest extends LongStreamTestBase { | ||
} |
63 changes: 63 additions & 0 deletions
63
...ts/grpc-streaming/src/test/java/io/quarkus/grpc/example/streaming/LongStreamTestBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package io.quarkus.grpc.example.streaming; | ||
|
||
import java.time.Duration; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.grpc.StatusException; | ||
import io.grpc.StatusRuntimeException; | ||
import io.grpc.examples.streaming.Streaming; | ||
import io.grpc.examples.streaming.StringReply; | ||
import io.grpc.examples.streaming.StringRequest; | ||
import io.quarkus.grpc.GrpcClient; | ||
import io.smallrye.mutiny.Multi; | ||
import io.smallrye.mutiny.Uni; | ||
import io.smallrye.mutiny.helpers.test.UniAssertSubscriber; | ||
|
||
@SuppressWarnings("NewClassNamingConvention") | ||
public class LongStreamTestBase { | ||
private final Logger log = LoggerFactory.getLogger(getClass()); | ||
|
||
@GrpcClient("streaming") | ||
Streaming streamSvc; | ||
|
||
@Test | ||
public void testQuickFailure() { | ||
Multi<StringRequest> multi = Multi.createFrom().range(1, 10) | ||
// delaying stream to make it a bit longer | ||
.call(() -> Uni.createFrom().nullItem().onItem().delayIt().by(Duration.of(1000, ChronoUnit.NANOS))) | ||
.map(x -> StringRequest.newBuilder() | ||
.setAnyValue(x.toString()) | ||
.build()); | ||
// .invoke(x -> log.info("Stream piece number is: " + x.getAnyValue())); | ||
|
||
UniAssertSubscriber<StringReply> subscriber = streamSvc.quickStringStream(multi) | ||
.subscribe().withSubscriber(UniAssertSubscriber.create()); | ||
|
||
subscriber | ||
.awaitFailure() | ||
.assertFailedWith(StatusRuntimeException.class); | ||
} | ||
|
||
@Test | ||
public void testMidFailure() { | ||
Multi<StringRequest> multi = Multi.createFrom().range(1, 10) | ||
// delaying stream to make it a bit longer | ||
.call(() -> Uni.createFrom().nullItem().onItem().delayIt().by(Duration.of(1000, ChronoUnit.NANOS))) | ||
.map(x -> StringRequest.newBuilder() | ||
.setAnyValue(x.toString()) | ||
.build()); | ||
// .invoke(x -> log.info("Stream piece number is: " + x.getAnyValue())); | ||
|
||
UniAssertSubscriber<StringReply> subscriber = streamSvc.midStringStream(multi) | ||
.subscribe().withSubscriber(UniAssertSubscriber.create()); | ||
|
||
subscriber | ||
.awaitFailure() | ||
.assertFailedWith(StatusException.class); | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...sts/grpc-streaming/src/test/java/io/quarkus/grpc/example/streaming/N2OLongStreamTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.quarkus.grpc.example.streaming; | ||
|
||
import io.quarkus.grpc.test.utils.N2OGRPCTestProfile; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
|
||
@QuarkusTest | ||
@TestProfile(N2OGRPCTestProfile.class) | ||
public class N2OLongStreamTest extends LongStreamTestBase { | ||
} |
10 changes: 10 additions & 0 deletions
10
...sts/grpc-streaming/src/test/java/io/quarkus/grpc/example/streaming/O2NLongStreamTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.quarkus.grpc.example.streaming; | ||
|
||
import io.quarkus.grpc.test.utils.O2NGRPCTestProfile; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
|
||
@QuarkusTest | ||
@TestProfile(O2NGRPCTestProfile.class) | ||
public class O2NLongStreamTest extends LongStreamTestBase { | ||
} |
10 changes: 10 additions & 0 deletions
10
...s/grpc-streaming/src/test/java/io/quarkus/grpc/example/streaming/VertxLongStreamTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package io.quarkus.grpc.example.streaming; | ||
|
||
import io.quarkus.grpc.test.utils.VertxGRPCTestProfile; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
|
||
@QuarkusTest | ||
@TestProfile(VertxGRPCTestProfile.class) | ||
public class VertxLongStreamTest extends LongStreamTestBase { | ||
} |