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

Add coverage for Quarkus #43422 #2186

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Conversation

jedla97
Copy link
Member

@jedla97 jedla97 commented Nov 12, 2024

Summary

Adding coverage for quarkusio/quarkus#43422 issue.

The PR to fix the original issue is quarkusio/quarkus#43440

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

@jedla97
Copy link
Member Author

jedla97 commented Nov 12, 2024

run tests

@jedla97
Copy link
Member Author

jedla97 commented Nov 12, 2024

Native is related will look at it

Copy link
Contributor

@jcarranzan jcarranzan left a comment

Choose a reason for hiding this comment

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

code LGTM thanks, but I'll wait for the native fixes updated and changes requested.

Copy link
Member

@rsvoboda rsvoboda left a comment

Choose a reason for hiding this comment

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

  • OPTIONS is not covered
  • what about other HTTP methods and sub-resource use case?
  • test failures need investigation

@jedla97
Copy link
Member Author

jedla97 commented Nov 13, 2024

Native issue was caused by this quarkusio/quarkus#42976 so I create different resource class where I tested it + testing it with interface.

Added OPTION request, what I tried it worked same even before the upstream PR.
Added POST method to sub-resource to check if it works (Personaly think that using it like this is more like edgecase)

@jedla97
Copy link
Member Author

jedla97 commented Nov 13, 2024

run tests

Copy link
Contributor

@jcarranzan jcarranzan left a comment

Choose a reason for hiding this comment

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

Thanks @jedla97 the tests look good to me and now are covering all topics mentioned.
I have two small suggestions:

  1. Could you consider creating a reusable helper method since most of tests have similar structure body?
  2. On the other hand, I am wondering if it would be good having some negative test that returns for instance a 405 status code where be appropiated.

@jedla97
Copy link
Member Author

jedla97 commented Nov 14, 2024

Could you consider creating a reusable helper method since most of tests have similar structure body?

@jcarranzan I created the methods for HEAD and OPTION requests. With that I combined them into one test.

On the other hand, I am wondering if it would be good having some negative test that returns for instance a 405 status code where be appropiated.

Tbh I don't see much added value in these negative tests. Also what should be testing? Not able to send DELETE request as it's not defined on endpoint? If you insist on adding something like this I can but as I said I don't see any adding value as I believe that this is tested by unit test in Quarkus/Vert.x/RestEasy

@jedla97
Copy link
Member Author

jedla97 commented Nov 14, 2024

run tests

@jcarranzan
Copy link
Contributor

Ok thanks, let's wait for the checks.

@rsvoboda rsvoboda merged commit 2ebfe00 into quarkus-qe:main Nov 14, 2024
9 checks passed
@Test
@Tag("https://github.com/quarkusio/quarkus/issues/43422")
@DisplayName("Test Quarkus REST using CDI getting the sub-resource for OPTION and HEAD request")
void cdiSubResourceOptionAndHeadRequest() {
Copy link
Member

@michalvavrik michalvavrik Nov 14, 2024

Choose a reason for hiding this comment

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

This is only method that fails with 3.15.1 in JVM mode. Why are other tests optionAndHeadRequestUsingInterfaceResourceWithPath and optionAndHeadRequestUsingAbstractResourceWithPath tagged with https://github.com/quarkusio/quarkus/issues/43422 if they are passing with 3.15.1 in JVM mode?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added the tag there as this issue was main motivation to create that coverage. If you things tha tag shouldn't be there. I can create PR for its removal.

Copy link
Member

Choose a reason for hiding this comment

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

Clear answer :-D :

I don't really care, keep it as it. I just thought that if you tag something with an issue, it means that issue is tested by this. It can still be true that changed code is not failing but testing changes because it can test code that we didn't have covered previously. What I do when I verify bug tickets is that I look for tests tagged with that issue. Now I'll keep in mind that failing test tagged with an issue may not mean that issue is not fixed. It probably won't happen anyway.

Copy link
Member

Choose a reason for hiding this comment

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

Also, why are other 3 tests added in this PR without this tag, is that because they were not added because of this issue or you just forgot?

Copy link
Member

Choose a reason for hiding this comment

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

Goodcatch @michalvavrik. @jedla97 can you prepare a followup PR with backport label?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, why are other 3 tests added in this PR without this tag, is that because they were not added because of this issue or you just forgot?

There are more like to ensure that endpoint work. The quarkus fix was to add HEAD and OPTION. At least this is my logic behind adding the tag here.

@jedla97 can you prepare a followup PR with backport label?

@rsvoboda with adding or removing the tags?

Copy link
Member

Choose a reason for hiding this comment

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

I think this kinda depends on how other QE members use @Tag, I always thought that it signals that some test tests the issue/ticket. But maybe that was just me.

Copy link
Member

Choose a reason for hiding this comment

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

@Tag usage ... there is no rule really, some members started to use it, but we didn't have any discussion and conclusion on its usage.

I would personally use @Tag only on tests testing the bug. I wouldn't tag the other related tests.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, thanks

@jedla97 jedla97 deleted the 43440-coverage branch November 15, 2024 08:52
@michalvavrik
Copy link
Member

@jedla97 I think we should try to have PR titled with a text that describes what PR does, you checked https://cbea.ms/git-commit/, coverage for Quarkus #43422 is less informative then Test support for @HEAD and @OPTIONS in sub-resources or something like that. I realize sometimes it is really hard to write correct title (and I often fail).

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.

4 participants