-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Reset in WireMock admin API not working fine. #372
Comments
What do you expect when you reset the mappings? (Or do you ask this for scenarios?) |
When I reset the mappings, I expect that every change in the stub mappings will be applied. For example to add a new stub mapping, I create the mappings file, then I have to reset my wiremock service to have these changes. I think that is better to use the Admin API to reset mappings changes that reset the wiremock service. |
Not quite sure if I follow, could it be that you want to:
? |
I want to:
The new mappings are not added to wiremock If I do not reset my wiremock service (without using Admin API). My mapping folder is like:
|
Ah I see. I am not sure if the mapping json files are found if these are present in sub folders. Did you try to copy the files directly in the mapping a folder? |
The mapping json files are found when I reset the Wiremock server, but not when I call reset from Admin API. |
|
Yes, I also implemented a custom IFileSystemHandler, but the point is how to update the mappings with the new changes without restart the WireMock server. |
|
Great!!, I think that both solution will be very useful. |
I keep this issue open until it's fixed. |
You can try new package from MyGet: And set WatchStaticMappingsInSubdirectories to true in the settings. |
I tested WireMock.Net.1.0.37-ci-12144.nupkg and I find this bug: New mappings are added, but It never delete the old changes until I restart WireMock server. Steps to reproduce:
Actual Result: Expected Result: |
Question, for step 4; how do you edit map2.json ? Via an editor directly? Or via a PUT on the admin interface? |
Via a text editor directly |
This is a different thing. If you just have a mapping file named There are 2 solutions for this:
|
Thanks for the WatchStaticMappingsInSubdirectories. I think that define a Guid in a text editor is tricky and it is not intuitive. Would it be possible to do? |
Sorry. The internal logic is using these guids. Normally when adding a mapping via the admin API, the guid is assigned and stored in the mapping file when it's saved. Also when proxying, the guide is defined. |
I've also added an extra parameter to the ResetMappingsAsync(bool? reloadStaticMappings = false); POST example = to Which will reload the static mappings after a reset (=delete) from the mappings. A preview NuGet can be found at MyGet --> WireMock.Net.1.0.37-ci-12153.nupkg |
Is this ok? |
This change is only for WireMock.Net.StandAlone? WireMock.Net.1.0.37-ci-12153.nupkg is the StandAlone |
Both nuget packages should be there with that 1.0.37-ci-12153 identifier. In your case, for testing you can use either package. |
It is work very well! I will use this functionality a lot. |
Reset service should reset all mappings, but it delete all stub mappings.
How could I reset mappings via web API ?
The text was updated successfully, but these errors were encountered: