WireMock.Net: WithWatchStaticMappings doesn't respect new files

Describe the bug

“–WatchStaticMappings true” command doesn’t respect new files copied. This is a bit annoying in docker in docker configuration where I can’t bind mappings using WithMappings() as docker bind always references the host and not the parent container.

Expected behavior:

On new file copy static mappings are read.

Test to reproduce

    private readonly WireMockContainer _wireMockContainer = new WireMockContainerBuilder()
        .WithWatchStaticMappings(true)
        .WithPortBinding(5000, 80)
        .Build();

   await _wireMockContainer.CopyAsync($"{AppDomain.CurrentDomain.BaseDirectory}Mappings", "/app/__admin/mappings");

Check mappings or make request

Other related info

Workaround exists using admin client: await _wireMockContainer.CreateWireMockAdminClient().ResetMappingsAsync(true);

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15

Most upvoted comments

I can prepare a test solution but I am bit busy this week. Basically I have dockerfile that runs my tests and since my tests run in docker then wiremock becomes a docker in docker setup.