Skip to content
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

Take RestMulti headers and status into account when using SSE resource method #44903

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dastrobu
Copy link

@dastrobu dastrobu commented Dec 3, 2024

This comment was marked as resolved.

@quarkus-bot quarkus-bot bot added the area/rest label Dec 3, 2024
@geoand
Copy link
Contributor

geoand commented Dec 3, 2024

Thanks!

Are you also interested in providing the actual fix?

We essentially need to update SseMultiSubscriber to use List<StreamingResponseCustomizer> in the same way as in StreamingMultiSubscriber

@dastrobu
Copy link
Author

dastrobu commented Dec 3, 2024

I am not sure I find the time right now. There is quite a bit of code to understand. The way you proposed does not seem to work out of the box, as there is some header handling going on in handleSse already:

SseUtil.setHeaders(requestContext, requestContext.serverResponse(), streamingResponseCustomizers);

@geoand
Copy link
Contributor

geoand commented Dec 3, 2024

Some adjustments will probably be needed, but my guess is that it shouldn't require figuring out much of what the test of the code does

@geoand geoand force-pushed the test/sse-response-header-test branch from 6cfe757 to 5653246 Compare December 4, 2024 07:59
@geoand geoand changed the title add unit test for adding a custom response header to a resource returning a sse multi. Take RestMulti headers and status into account when using SSE resource method Dec 4, 2024
@geoand geoand marked this pull request as ready for review December 4, 2024 08:00
@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

I have updated this PR to include a fix for the issue

@dastrobu
Copy link
Author

dastrobu commented Dec 4, 2024

@geoand thanks, I did no look through the code in detail, but I think its not handling all cases correctly. I extended ResponseHeaderTest to cover the same cases as for non-SSE Multis. I can probably delete MultiResponseHeadersTest as it seems to be redundant.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

If you have cases which don't work with the current implementation, please add tests for them

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

@dastrobu let me know when you are done so I can check the latest tests.

Thanks

@dastrobu dastrobu force-pushed the test/sse-response-header-test branch from 4a09268 to 1a8aeda Compare December 4, 2024 10:36
@dastrobu
Copy link
Author

dastrobu commented Dec 4, 2024

I had to rebase and force push, as quarkus-bot was complaining about the merge:

quarkus-bot
/ Check Pull Request - Merge commits

Error - Pull request commit check
[sha=2f089a593200bd8c229aa53ca9e8671238d9744a ; message="Merge remote-tracking branch 'dastrobu/test/sse-response-header-test' into test/sse-response-header-test"]

I think I am done, but let's wait for CI to see the test cases.
Locally, there are two cases that are not passing:

  • testReturnRestSse3()
  • testReturnRestSse5()

We probably need to squash commits before merging in the end, but I don't want to do that right now as long as contributing from both ends.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

Don't worry about the bot and squashing the commits, I'll take care of that.

I think I am done

Okay, thanks

This comment has been minimized.

@geoand geoand force-pushed the test/sse-response-header-test branch from 1a8aeda to 6a8af7c Compare December 4, 2024 12:24
@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

This is now ready to go. Thanks a lot @dastrobu!

@dastrobu
Copy link
Author

dastrobu commented Dec 4, 2024

@geoand thanks for implementing the fix. It was a pleasure to collaborate on a PR that quickly. It's a rare experience in the open-source universe.

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

🙏🥰

@geoand geoand force-pushed the test/sse-response-header-test branch from 6a8af7c to 949f45c Compare December 4, 2024 13:26
Copy link

quarkus-bot bot commented Dec 4, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 949f45c.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
JVM Tests - JDK 17 Build Failures Logs Raw logs 🔍
JVM Tests - JDK 21 Build Failures Logs Raw logs 🔍
JVM Tests - JDK 17 Windows Build Failures Logs Raw logs 🔍

Full information is available in the Build summary check run.
You can consult the Develocity build scans.

Failures

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/resteasy-reactive/rest-jaxb/deployment integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir 
! Skipped: integration-tests/hibernate-validator-resteasy-reactive 

📦 extensions/resteasy-reactive/rest-jaxb/deployment

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testMultiFromMulti line 104 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testSseFromMulti line 68 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

📦 integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir

io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists line 16 - History - More details - Source on GitHub

java.lang.AssertionError: 

Expecting path:
  /home/runner/work/quarkus/quarkus/integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir/target/proto
to exist (symbolic links were followed).
	at io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists(DescriptorSetExistsTest.java:16)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

⚙️ JVM Tests - JDK 21 #

- Failing: extensions/resteasy-reactive/rest-jaxb/deployment integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir 
! Skipped: integration-tests/hibernate-validator-resteasy-reactive 

📦 extensions/resteasy-reactive/rest-jaxb/deployment

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testMultiFromMulti line 104 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testSseFromMulti line 68 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

📦 integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir

io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists line 16 - History - More details - Source on GitHub

java.lang.AssertionError: 

Expecting path:
  /home/runner/work/quarkus/quarkus/integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir/target/proto
to exist (symbolic links were followed).
	at io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists(DescriptorSetExistsTest.java:16)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

⚙️ JVM Tests - JDK 17 Windows #

- Failing: extensions/resteasy-reactive/rest-jaxb/deployment integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir 
! Skipped: integration-tests/hibernate-validator-resteasy-reactive 

📦 extensions/resteasy-reactive/rest-jaxb/deployment

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testMultiFromMulti line 104 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

io.quarkus.resteasy.reactive.jaxb.deployment.test.SseResourceTest.testSseFromMulti line 68 - History - More details - Source on GitHub

org.opentest4j.AssertionFailedError: 

Expecting actual:
  []
to contain exactly (and in same order):
  ["hello"]
but could not find the following elements:
  ["hello"]

📦 integration-tests/grpc-descriptor-sets/grpc-descriptor-set-alternate-output-dir

io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists line 16 - History - More details - Source on GitHub

java.lang.AssertionError: 

Expecting path:
  D:\a\quarkus\quarkus\integration-tests\grpc-descriptor-sets\grpc-descriptor-set-alternate-output-dir\target\proto
to exist (symbolic links were followed).
	at io.quarkus.grpc.examples.hello.DescriptorSetExistsTest.descriptorSetExists(DescriptorSetExistsTest.java:16)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

@geoand
Copy link
Contributor

geoand commented Dec 4, 2024

The test failure is related, I'll have a look tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting headers for SSE annotated Multi resources is ignoring headers
2 participants