-
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 test coverage for issue 36402 #1508
Conversation
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.
Hey @jedla97 , I have more than one comment, but I have doubts we need a new module and so much code to test missing classes in the REST Client Classic. I'll verify you are right and get back to you when I have a time. Please wait till then, thank you.
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 have tested it a bit and all that I needed to reproduce the issue was following patch (I'm pretty sure you can simplify that as well, but I don't have more time)
Subject: [PATCH] sse-native
---
Index: http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseClient.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseClient.java b/http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseClient.java
new file mode 100644
--- /dev/null (date 1699377305495)
+++ b/http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseClient.java (date 1699377305495)
@@ -0,0 +1,18 @@
+package io.quarkus.ts.http.advanced;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.event.Observes;
+import jakarta.enterprise.event.Startup;
+import jakarta.ws.rs.client.ClientBuilder;
+import jakarta.ws.rs.client.WebTarget;
+import jakarta.ws.rs.sse.SseEventSource;
+
+@ApplicationScoped
+public class SseClient {
+
+ void callSomeMethod(@Observes Startup startup) {
+ WebTarget target = ClientBuilder.newClient().target("http://localhost:8080/updates");
+ var src = SseEventSource.target(target).build();
+ System.out.println("I have a client " + src);
+ }
+}
with command mvn clean verify -Dnative -Dit.test=HttpAdvancedIT -Dquarkus.platform.version=3.2.7.Final
Please refactor it to your needs. Do you agree that it will cost us much less of execution time and it's easier to read? Please feel free to contradict. Thanks
Hi, @michalvavrik did you mean me or it was mistake as the@ mocenas created this PR and the questions more target PR creator. |
Sorry @jedla97 for some reason I thought you opened issues. I thought it was weird considering to who is assigned to the JIRA ticket :-D |
@mocenas the comment was for you |
@michalvavrik I agree that your solution is simpler and faster, but I'm not sure I like it.
I'm new to issue-test-coverage this stuff so correct me if I'm wrong at my line of thinking. |
Agreed, that's is why I spent time understanding a root cause of issue and principle how it works and created simplified reproducer. Issue has literally nothing to do with picocli.
My solution was POC for you, it's your job and I won't tell you how to do this. If I were to do this reproducer, I'd simply put what I added from startup observer to resource method and call it from a unit test, which tells you exactly what is tested
+1, please see answer above
no worry, if you put it to resource method, it interferes with nothing as you are bringing in no dependencies or application class changes, you can only add new resource class
no it does not, I already explained it |
@mocenas one else thing - there is nothing wrong about your reproducer (which is adjusted upstream reproducer, right?), my argument is that resources are tight, my suggestion will add couple of microseconds to execution time, new module build in native will add couple of minutes on my workstation |
@michalvavrik I've refactored the test to be in http-advanced module. |
http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpSseIT.java
Outdated
Show resolved
Hide resolved
http/http-advanced/src/test/java/io/quarkus/ts/http/advanced/HttpSseIT.java
Outdated
Show resolved
Hide resolved
http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseResource.java
Outdated
Show resolved
Hide resolved
http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseResource.java
Outdated
Show resolved
Hide resolved
http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseResource.java
Outdated
Show resolved
Hide resolved
http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/SseResource.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.
overall looks good, I need to leave now for a while, I'll review & merge this later today. only thing that really concerns me is whether we need dedicated test class (we have comment thread on that)
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.
lgtm, let see what CI says (I'll re-run test locally before I merge it)
Create test coverage for issue: quarkusio/quarkus#36402.
Summary
Issue fails the Server Sent Events (SSE) while in native mode. New coverage adds app to simulate & test this behavior.
Original reproducer is here.
Please select the relevant options.
run tests
phrase in comment)Checklist: