-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support injecting OIDC WireMockServer into tests #20035
Conversation
Hi @dimas-b, thanks for this PR - does the test pass with @stuartwdouglas Can you also have a look please ? May be instantiating Thanks |
My understanding is that If there's a better way to trigger the injection logic - by all means please let me know and I will update this PR. |
It does, although I do not think this flag makes a real difference since the test does not actually bring a full Quarkus server up. |
I've pushed another commit to add a test with an invalid toke to Is this what you meant for providing a practical example? |
@dimas-b thanks, looks good with a new test. Can you please squash the commits ? One other question, do you think it can make sense to drop Thanks |
@sberyozkin : There's already a I'll squash as soon as we settle on a name for the annotation :) |
@dimas-b Sorry, missed your last comment, I see, following the same pattern if it is already used in one other place in Quarkus makes sense, though I also like your idea of naming it as |
* Define a custom annotation: OidcWireMock for tests to indicate they want the WireMock Server injected. * Override inject(TestInjector) in OidcWiremockTestResource to allow tests to receive the WireMockServer used by OidcWiremockTestResource This is to allow (external) tests to mock extra URLs, that are not covered by OidcWiremockTestResource * Add bearer auth test for invalid token. Use a custom wiremock stub for generating responses for the invalid token.
0ac955d
to
fa444fe
Compare
Renamed, squashed and rebased |
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.
@dimas-b thanks for your PR. I'll follow up with a doc update as I don't want to hold this PR any longer. (if you can find some time - please do a small example to https://quarkus.io/guides/security-openid-connect#integration-testing-wiremock to introduce this option)
Follow-up docs PR: #20118 |
@sberyozkin : Would it be possible to backport this to 2.2.x? |
Define a custom annotation: InjectWireMock
Override inject(TestInjector) in OidcWiremockTestResource
to allow tests to receive the WireMockServer
used by OidcWiremockTestResource
This is to allow (external) tests to mock
extra URLs, that are not covered by OidcWiremockTestResource
If this PR is accepted, please consider back-porting to Quarkus 2.2.x