-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests coverage for REST client reactive using HTTP2 #1637
Conversation
37cc3d7
to
ce004ca
Compare
The Cookie test failing also on daily so it's not caused by this PR |
The issue is already closed so we can run again the tests |
The failing test are just cookies which will be fixed by #1639 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jedla97, I've left some minor comments, but overall, the code looks good to me. Additionally, I was thinking that you might consider including a couple of tests that intentionally induce failures or check for the possibility of receiving a status code other than 200.
Thank you
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Outdated
Show resolved
Hide resolved
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Outdated
Show resolved
Hide resolved
...ive/src/test/java/io/quarkus/ts/http/restclient/reactive/HttpVersionAlpnWithConfigKeyIT.java
Outdated
Show resolved
Hide resolved
http/rest-client-reactive/src/main/resources/httpVersion.properties
Outdated
Show resolved
Hide resolved
f13e12e
to
f84d112
Compare
Thanks for review @jcarranzan I update things which you have pointed out.
In this I will try thing about negative scenario and if I have some idea I'll create standalone PR for it. It's there yous to check but not testing the client itself. The test calling endpoint where is the client created/injected and that endpoint calling another endpoint as rest client. So status in tests is there just to check that's response is as expected (client use/not use http2). If there will be some problem with client it should return 500. |
Just note why we can't use the rest client directly in test: Tl;DR : At this moment quarkus rest client reactive is not meant to be used standalone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the tweaks, just only a comment about the MalformedURLException signature and I'll approve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have time to review this right now (not that I was asked to :-D), but once this is approved please do not merge. There is a lot of changes (nothing against them!) and I'd like to check when I find a time. Thanks
http/rest-client-reactive/src/main/resources/httpVersion.properties
Outdated
Show resolved
Hide resolved
...ive/src/main/java/io/quarkus/ts/http/restclient/reactive/HttpVersionClientWithConfigKey.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine. @jcarranzan please have a look next week, review and merge. If you need more time, can you maybe create dedicated ticket for yourself in JIRA, please? Let's move on. Thx
...rc/main/java/io/quarkus/ts/http/restclient/reactive/resources/HttpVersionClientResource.java
Show resolved
Hide resolved
import io.smallrye.mutiny.Uni; | ||
|
||
@ApplicationScoped | ||
@Path("/httpVersion") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Path("/httpVersion") | |
@Path("/http-version") |
That's usual convention, or are you testing whether it works with case sensitive path? If so, let's document.
@QuarkusScenario | ||
public class HttpVersionAlpnWithConfigKeyIT { | ||
|
||
String SUCCESSFUL_RESPONSE_STRING = "Hello " + NAME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String SUCCESSFUL_RESPONSE_STRING = "Hello " + NAME; | |
private static final String SUCCESSFUL_RESPONSE_STRING = "Hello " + NAME; |
.build(HttpVersionClient.class); | ||
|
||
Response response = httpVersionClient.getClientHttpVersionAsync(NAME).await() | ||
.atMost(Duration.ofSeconds(TIMEOUT_SECONDS)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think blocking here is just laziness, there is no point to it. Asynchronous test should be processed in a reactive manner and return stuff asynchronously from resource as well. Please feel free to prove me wrong. Thanks
|
||
/** | ||
* Create HttpVersionClient and make REST client asynchronous request to `httpVersion/asynchronous endpoint` | ||
* Response from the client is checked if http 2 was used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Response from the client is checked if http 2 was used | |
* Response from the client is checked if HTTP/2 was used |
please check other comments as well. As you have already decided to write nice Java doc.
@GET | ||
@Path("synchronous") | ||
public Response sayHello(@QueryParam("name") String name) { | ||
return Response.ok("Hello " + name).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello is fine, you can keep it if you want as it tests query param. It would be nice to have incoming request protocol in response. This way, you can check that REST client is telling you a true about used HTTP version. I propose to inject RoutingContext
, then io.vertx.ext.web.RoutingContext#request
-> io.vertx.core.http.HttpServerRequest#version
should always return HTTP_2
.
@jedla97 let's add info about HTTP/2 for REST client into root project README |
@jcarranzan I update all the comments mentioned by @michalvavrik so can you have quick look. Also add mention of these test to the README. |
Changes LGTM, and tests are correct as well. However I noticed the test classes seem to contain repetitive tests, and perhaps using inheritance could consolidate tests into a single class. Nonetheless, I respect the current approach, it's simply a different way of approaching the tests. |
Changes LGTM, and tests are correct as well. However I noticed the test classes seem to contain repetitive tests, and perhaps using inheritance could consolidate tests into a single class. Nonetheless, I respect the current approach, it's simply a different way of approaching the tests. |
Thanks for review
When writing the test I was thinking about it, but if we want one class as base for multiple tests there would be subset of 2 tests for all 4 tests classes. In my POV it's not that useful in this scenario.
I update the solution but sum it in one comment as I was resolve all the comment on code side (not GitHub side) |
Summary
Adding test coverage for QUARKUS-658.
This cover basic scenarios which Quarkus users can use.
The
http2ClientAsync
andhttp2ClientSync
which are removed is covered by new tests. In addition the class these test were using were also removed. The ones from http-advanced were removed completely as Quarkus doesn't plan to support the non-reactive client.Please select the relevant options.
run tests
phrase in comment)Checklist: