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
Cannot use InjectMock with gRCP generated classes #23618
Comments
I proposed on Zulip that we introduce an ASM transformation to strip the |
Until this is fixed, what's the way to have integration tests with gRPC clients? Is there an alternative to mocking at the moment? I tried to find documentation on this, but could not find anything? |
We need to be very careful with this. The |
Absolutely |
|
Looked into this a little and unfortunately it's more complicated... The most serious issue is that |
where do I find that? |
We only provide the mutiny template. We cannot modify the other one. |
Understood. The other one is the problematic one 🥺 |
Yes, and we need to be careful with what we will generate to avoid that situation while being close-enough from protoc |
Allows mocking gRPC mutiny clients
Describe the bug
We're trying to mock a gRPC client using
InjectMock
like so:DeviceService
is one of the autogenerated gRPC classes, and specifically is defined like thispublic interface DeviceService extends MutinyService
.Running the test fails with:
Since
DeviceService
is a Singleton, then as per the docs https://quarkus.io/guides/getting-started-testing#further-simplification-with-injectmock we should useconvertScopes = true
.Doing so, produces the same error.
Expected behavior
InjectMock(convertScopes = true)
should mock the generated gRPC sources, since these have Singleton scope.Actual behavior
Tests fail with
How to Reproduce?
No response
Output of
uname -a
orver
Linux homer 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.2.2.Final
(Also tested with
2.7.1.Final
, still the same.)Build tool (ie. output of
mvnw --version
orgradlew --version
)Additional information
No response
The text was updated successfully, but these errors were encountered: