mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
How to use WiremockContainerBuilder for grpc using http2 #662
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GomesNayagam on GitHub (Jan 18, 2025).
Originally assigned to: @StefH on GitHub.
container should spin up and ready for testing.
timeout exception
@StefH commented on GitHub (Jan 18, 2025):
@GomesNayagam : for better readability, you can use markdown syntax highlighting.
json
And C#
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks
@StefH commented on GitHub (Jan 18, 2025):
To answer your question:
The code you provided is starting WireMock (www.wiremock.org) and not this project.
See this page on how to use it:
https://github.com/WireMock-Net/WireMock.Net/wiki/Using-WireMock.Net.Testcontainers
@GomesNayagam commented on GitHub (Jan 21, 2025):
Hi @StefH I tried with new image and container able to up and running but when i query for mapping http://127.0.0.1:49160/app/__admin/mappings
it is throwing. "No matching mapping found"
@StefH commented on GitHub (Jan 21, 2025):
1] I think the URL you need to use is
http://127.0.0.1:49160/__admin/mappings(no app)2]
.withhttpversion("2")For this to work, you need to provide different urls to TestContainers
Can you try
Where
http://x.x.x.x:8080is the admin url + port to get / post the mappings.And
grpc://x.x.x.x:9090is the url + port for GRPC.(Note that you need to provide the correct values for x.x.x.x)
@GomesNayagam commented on GitHub (Jan 21, 2025):
@StefH I tried the above with this code coz i dont want to use any static ip not sure how that works, i am okey to have localhost.
POST: grpc://127.0.0.1:53296/grpc
Method: SayHello
Expected: work similar like this article says https://mstack.nl/blogs/wiremock-net-grpc/
Note i tried this preview as well 1.6.12-ci-19580, looks grpc server is not running in this container? correct me if i am wrong.
@StefH commented on GitHub (Jan 27, 2025):
@GomesNayagam
This is indeed not supported yet, I'll take a look if this can be added.
@StefH commented on GitHub (Jan 27, 2025):
Can you try this:
This will make sure that WireMock.Net inside the container will internally listen to 80 and 9090 and externally will use random ports.
You get get the random ports using:
Getting the mappings on the httpPort should work.
And calling GRPC method on the grpcPort should also work.
@GomesNayagam commented on GitHub (Jan 27, 2025):
@StefH below error
Error outpu:
@StefH commented on GitHub (Jan 27, 2025):
And this?
@StefH commented on GitHub (Jan 27, 2025):
https://github.com/WireMock-Net/WireMock.Net/pull/1246
@StefH commented on GitHub (Jan 27, 2025):
Or try preview NuGet version 1.7.1-ci-19645
Which can be used like this:
@GomesNayagam commented on GitHub (Jan 27, 2025):
@StefH port were running but grpc is not working.
files were in ..\mocks\greet\hellorequest.json
80 port works and able to get mapping details.
9090 grpc is nto working with grpc or http protocol. (used postman)
code
error log:
@StefH commented on GitHub (Jan 28, 2025):
It should be fixed.
Get latest preview and see this code:
https://github.com/WireMock-Net/WireMock.Net/blob/stef-1239-testcontainers-grpc/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.Grpc.cs#L130
@GomesNayagam commented on GitHub (Jan 29, 2025):
@StefH this works, also luv to see the container works like static server, to add protodefinition and refer it from mappings. like
Another request, can you remove this file and related code base as i provided this for e.g and i don't want to be in trouble from my company or atleast remove the line# 27 to 37 and update with some dummy value.
https://github.com/WireMock-Net/WireMock.Net/blob/master/test/WireMock.Net.Tests/Grpc/policy.proto#L27C2-L37C24
@StefH commented on GitHub (Jan 29, 2025):
@GomesNayagam
@GomesNayagam commented on GitHub (Jan 30, 2025):
@StefH appreciate it here is the feature request https://github.com/WireMock-Net/WireMock.Net/issues/1249 and let me know when the above tested pre release will be in main release.