-
Notifications
You must be signed in to change notification settings - Fork 107
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
A sample application using a mock server #116
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,2 @@ | |||
FROM rodolpheche/wiremock as mockserver | |||
COPY config /home/wiremock |
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.
I think it would be nice to add a 3rd way to add a docker job by specify the docker hub name, or did I miss it?
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.
I think we could add another property dockerSourceImage
, and, when present, instead of doing a docker build
, do a docker pull
then tagging the image with the dockerImageName
so that the rest of the logic stay the same.
What do you think @sebastienros ? would you accept a PR for that?
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.
I agree with the suggestion. Had the same issue myself which required me to create a dumb docker file. dockerImage
? Would allow for name and tag. And change how dockerImageName is constructed when not provided to be sure the tag part is not interfering with the syntax of the command line.
: $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} --network SELF --ip {hostname} {imageName} {source.DockerCommand}"; | ||
: string.Equals(hostname, "localhost", StringComparison.OrdinalIgnoreCase) | ||
? $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} -p {job.Port}:{job.Port} {imageName} {source.DockerCommand}" | ||
: $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} --network SELF --ip {hostname} {imageName} {source.DockerCommand}"; |
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.
I had to run this to be able to run locally on windows without having to create a network and to be able to map the port.
Not sure however if that Port
parameter is the correct parameter.
Maybe there should be a more generic argument to pass parameter to docker while I believe currently you can only specify arguemnts to the container
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.
I think we can just keep the port:port version on Windows. I used SELF because I was trying to create a faster network interface, but at least if port:port works it's better for now.
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.
I know ...
: $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} --network SELF --ip {hostname} {imageName} {source.DockerCommand}"; | ||
: string.Equals(hostname, "localhost", StringComparison.OrdinalIgnoreCase) | ||
? $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} -p {job.Port}:{job.Port} {imageName} {source.DockerCommand}" | ||
: $"run -d {environmentArguments} {job.Arguments} --label benchmarks --name {containerName} --network SELF --ip {hostname} {imageName} {source.DockerCommand}"; |
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.
I think we can just keep the port:port version on Windows. I used SELF because I was trying to create a faster network interface, but at least if port:port works it's better for now.
@@ -0,0 +1,2 @@ | |||
FROM rodolpheche/wiremock as mockserver | |||
COPY config /home/wiremock |
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.
I agree with the suggestion. Had the same issue myself which required me to create a dumb docker file. dockerImage
? Would allow for name and tag. And change how dockerImageName is constructed when not provided to be sure the tag part is not interfering with the syntax of the command line.
@@ -0,0 +1,57 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. |
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.
Could use the new WebApplicationBuilder model now
}); | ||
}); | ||
|
||
Console.WriteLine($"AspNetCore location: {typeof(IWebHostBuilder).GetTypeInfo().Assembly.Location}"); |
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.
Not necessary. Results show the version automatically.
Hi @sebastienros ! I know .... 😂 I've not being using Crank recently. I wonder if this could still be useful or is there already an implemented alternative? Thanks! |
Hi @sebastienros
I've created a sample application using wiremock as mock server.
Opening this mainly to discuss the approach and a few potential improvements I thought of with this experiment, before raising them as issues.
The idea of having a Wiremock job is that you can easily setup canned response in its json configuration, which is quite flexible. Not sure however if performance would be good enough (and how accurate is the applied delay).
Other comments in line