Skip to content

Unable to build WireMockContainerBuilder with custom image #1390

@OliBomby

Description

@OliBomby

Describe the bug

Custom WireMock images that include their own mappings like from the guide can not be used in WireMockContainerBuilder.WithImage() leading to a InvalidOperationException on Build() because _imageOS is never set.

Expected behavior:

var container = new WireMockContainerBuilder()
            .WithLinuxImage()
            .WithImage("custom-wiremock:latest")
            .WithAutoRemove(true)
            .WithCleanUp(true)
            .Build();

await container.StartAsync().ConfigureAwait(false);
var client = container.CreateClient();
// Start requesting the built-in mappings

I expect with the above code to work an not throw an exception. However after WithLinuxImage() _imageOS is still set to null because the builder objects gets recreated from scratch with only the docker config remaining.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions