-
-
Notifications
You must be signed in to change notification settings - Fork 213
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 protodefinition and refer it from mapping #1249
Comments
A new preview version from WireMock.Net + Docker container is created: 1.7.2-preview-01 This example should work now: var wireMockContainer = new WireMockContainerBuilder()
.WithAutoRemove(true)
.WithCleanUp(true)
.AddUrl("grpc://*:9090")
.AddProtoDefinition("my-greeter", ReadFile("greet.proto"))
.Build(); |
@StefH it throws method not allowed error: Code used using these files var protoDefinition = File.ReadAllText(
TestHelper.GetAbsolutePath("Grpc") + @"\greet.proto"
);
var wireMockContainer = new WireMockContainerBuilder()
.WithAutoRemove(true)
.WithCleanUp(true)
.WithCommand("--UseHttp2")
.AddUrl("grpc://*:9090")
.AddUrl("http://*:8080")
.AddProtoDefinition("my-greeter", protoDefinition)
.Build();
await wireMockContainer.StartAsync();
var mappingsJson = File.ReadAllText(
TestHelper.GetAbsolutePath(@"mocks\greet") + @"\hellorequest.json"
);
var address = wireMockContainer.GetPublicUrls()[9090];
var address2 = wireMockContainer.GetPublicUrls()[8080];
using var httpClient = wireMockContainer.CreateClient();
var result = await httpClient.PostAsync("/__admin/mappings", new StringContent(mappingsJson, Encoding.UTF8, "application/json"));
result.EnsureSuccessStatusCode();
var channel = GrpcChannel.ForAddress(address);
var client = new Greeter.GreeterClient(channel);
var res = await client.SayHelloAsync(new HelloRequest { Name = "stef" }); |
Are you sure you have the correct docker container version? BTW I used protobug-mapping-4 as test. |
thats the good point let me delete the image and retry and let u know |
apologies for my silly mistake, it works. great work once again. @StefH pls tag me when it is publicly available. hope u tag new version for those docker image as well besides client version. |
|
Feature Request
I am planning to use grpc mock using docker container via WireMockContainerBuilder() like standalone WIreMock.Start() server. While doing that i noticed i am missing .AddProtoDefinition(id, protoDefinitionText) signatue for Container way.
Describe the solution you'd like
Prefer to as close as possible like
Describe alternatives you've considered
Is your feature request supported by WireMock (java version)? Please provide details.
Verified with WireMock.Net author and it is possible to include this feature.
Additional context
More discussion here
#1239
The text was updated successfully, but these errors were encountered: