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

Test coverage for ensuring the MessageBodyWriter is used with null Accept header #1949

Merged

Conversation

jcarranzan
Copy link
Contributor

@jcarranzan jcarranzan commented Aug 28, 2024

Summary

Coverage for backports 3.8.6 --> quarkusio/quarkus#41411 - Ensure that MessageBodyWriter is passed the proper media type.
Verify that currently , it works with quarkus-rest

Notice this was failing with quarkus version:
mvn clean verify -Dquarkus.platform.version=3.11.2 -Dit.test=HeadersIT#testWithNoAcceptHeader -Dreruns=0

Also, I noticed that the fix is not working with quarkus-resteasy,I'll open a bug related to.

Please select the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • Dependency update
  • Refactoring
  • Backport
  • New scenario (non-breaking change which adds functionality)
  • This change requires a documentation update
  • This change requires execution against OCP (use run tests phrase in comment)

Checklist:

  • Methods and classes used in PR scenarios are meaningful
  • Commits are well encapsulated and follow the best practices

@jcarranzan jcarranzan marked this pull request as ready for review August 28, 2024 09:35
@jcarranzan jcarranzan marked this pull request as draft August 28, 2024 10:30
@jcarranzan jcarranzan requested review from jedla97 and removed request for gtroitsk August 28, 2024 13:00
@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch from fa67b16 to 58624c3 Compare August 28, 2024 14:14
@jcarranzan jcarranzan marked this pull request as ready for review August 28, 2024 14:16
Copy link
Member

@jedla97 jedla97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for coverage. I have some comments and suggestion.

Copy link
Member

@michalvavrik michalvavrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of coverage like this?

Upstream has completely same Quarkus REST tests, don't you trust upstream CI that has to pass or do you expect something specific for a product? I don't think we should mirror every test in upstream. @fedinskiy do we really need to test this? Cannot you use upstream test coverage label?

@michalvavrik
Copy link
Member

michalvavrik commented Aug 29, 2024

Test coverage for backport 3.8.6-41411

Please improve PR title, it will take just a few seconds to make clear what 41411 is. Thank you

@jcarranzan
Copy link
Contributor Author

jcarranzan commented Aug 29, 2024

What is the point of coverage like this?

Upstream has completely same Quarkus REST tests, don't you trust upstream CI that has to pass or do you expect something specific for a product? I don't think we should mirror every test in upstream. @fedinskiy do we really need to test this? Cannot you use upstream test coverage label?

@michalvavrik the point is to verify the upstream backports for 3.8.6, and when I do that I try to create some test coverage in our TS, verify some corner cases(RestEasy), etc, but you are right if these tests are already in upstream tests, I don't want duplicity.
Maybe, I am missing something in the backports testing process, What is your way of proceeding in these cases?
Thanks

@michalvavrik
Copy link
Member

Maybe, I am missing something in the backports testing process, What is your way of proceeding in these cases?
Thanks

Yeah @jcarranzan , your work is alright. The reason why I am asking @fedinskiy (responsible for this release) is that I would simply replace this with JIRA label. Because there are some backports that is alright not to test. So I cannot let what's next, all my comments are rather opinions, you don't need to follow them :-)

@jcarranzan jcarranzan changed the title Test coverage for backport 3.8.6-41411 Test coverage for ensuring the MessageBodyWriter is used with null Accept header - backport 3.8.6#41411 Aug 29, 2024
@michalvavrik
Copy link
Member

Anyway @jcarranzan @jedla97 feel free to proceed with this PR, I don't mean to obstruct.

@fedinskiy
Copy link
Contributor

@michalvavrik just in case: this task is related to 3.8.6, and I am responsible for 3.15 :)

@michalvavrik
Copy link
Member

@michalvavrik just in case: this task is related to 3.8.6, and I am responsible for 3.15 :)

damn!

@michalvavrik
Copy link
Member

In that case I'll leave this to @jcarranzan and @jedla97 and move to my tasks.

@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch from 1adbf8c to c069169 Compare August 29, 2024 07:23
@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch from f0fde39 to a1ed08a Compare August 29, 2024 08:51
@jcarranzan
Copy link
Contributor Author

Issue created: quarkusio/quarkus#42854

Copy link
Member

@jedla97 jedla97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcarranzan Thanks for update. In overall it's look good to me. Just have 2 suggestion and also unresolve the thread about that logging with question.

@jedla97
Copy link
Member

jedla97 commented Aug 29, 2024

Also looking at the test and it seems that HeadersMessageBodyWriter changing all other tests so they are failing.

@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch from 471377b to d3e7a96 Compare August 29, 2024 11:06
@jcarranzan
Copy link
Contributor Author

Also looking at the test and it seems that HeadersMessageBodyWriter changing all other tests so they are failing.

Fixed!, thanks @jedla97 .

@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch 4 times, most recently from c31c109 to 26de7b5 Compare August 29, 2024 14:38
@jcarranzan jcarranzan force-pushed the backports/3.8.6-backports-41411 branch 3 times, most recently from 0079f9e to 91db874 Compare August 30, 2024 06:52
Copy link
Member

@jedla97 jedla97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jcarranzan I'm looking at this and don't like that this message header writer affecting other test and resources.

I looked at it and proposing solution.

That MessageBodyWriter<String> won't be catching a modify the all String responses but you will create new class (your own datatype) and it will be modified only the response types of this class. So the implementation will be something like MessageBodyWriter<MySimpleClass>.

What I have looked it's valid usecase + you will have different test then is covered in upstream as bonus. I'll leave the implementation details on you. Just FYI I tried it with simple class and it worked.

Also when we use this implementation we don't need separate test class just for this one test (save few minutes when executing native 😄)

Copy link
Member

@jedla97 jedla97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at proposed solution! I have few small comments .

Also I see that you checked the Backport in Pr description. This point is used when you backorting something to different branch.

Looking at HeadersIT the it's run on openshift OpenShiftHeadersIT so the This change requires execution against OCP (use run tests phrase in comment) point should be checked to not merge this before we run ocp tests

@jedla97 jedla97 force-pushed the backports/3.8.6-backports-41411 branch 2 times, most recently from 9bc2d17 to c23d6a9 Compare September 2, 2024 21:06
@jedla97
Copy link
Member

jedla97 commented Sep 2, 2024

run tests

@jedla97
Copy link
Member

jedla97 commented Sep 3, 2024

@michalvavrik can you do a review as I was finished this PR.

@@ -93,6 +96,19 @@ void testPathSpecificHeaderRulesOrder() {
cacheControlMatches(response, "max-age=1");
}

@Test
@Tag("https://github.com/quarkusio/quarkus/pull/41411")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refuse to believe that PR only changing independent RESTEasy Reactive library has to be tested in the RESTEasy Classic. They are completely independent implementations.

If you mean to test that same issue is not present in the RESTEasy Classic, I can respect that (though I would not), but I would not link the PR. Maybe link the issue and add comment that this is not reproducing, just verifying it is not there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm for having the same test in RESTEasy Classic to ensure the same behavior in this case.

+1 to have just comment as @michalvavrik suggested, that coverage is inspired by the issue, but it's not reproducing it on classic side.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I was thinking yesterday if I should remove this classic coverage. Your reasoning make sense so I remove it.

@jcarranzan if you still think that we should test even the rest classic please create PR

Copy link
Member

@michalvavrik michalvavrik Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's nice you be agreed with @jedla97 , but @rsvoboda doesn't :-) maybe just tweak the comment.

my thinking was that users shouldn't use RESTEasy Classic anyway, so I care way less about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh now I read @rsvoboda comment so I will update it back

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted back + changed to use original issue in comment

@rsvoboda rsvoboda changed the title Test coverage for ensuring the MessageBodyWriter is used with null Accept header - backport 3.8.6#41411 Test coverage for ensuring the MessageBodyWriter is used with null Accept header Sep 3, 2024
@jedla97 jedla97 force-pushed the backports/3.8.6-backports-41411 branch 2 times, most recently from 8d08dd1 to 3a3e9cb Compare September 3, 2024 08:27
Copy link
Member

@michalvavrik michalvavrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job well done @jedla97 .

@michalvavrik michalvavrik merged commit 8a130aa into quarkus-qe:main Sep 4, 2024
8 checks passed
@michalvavrik michalvavrik deleted the backports/3.8.6-backports-41411 branch September 4, 2024 08:39
@jedla97 jedla97 added this to the 3.8 milestone Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants