Skip to content
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

Order of WireMockContainerBuilder WithX calls caused duplicate Networks in Configuration #1217

Closed
epDugas opened this issue Dec 11, 2024 · 8 comments
Assignees
Labels

Comments

@epDugas
Copy link
Contributor

epDugas commented Dec 11, 2024

Describe the bug

The order of the .WithX calls to WireMockContainerBuilder can cause duplicate Networks in Configuration.

Expected behavior:

Expected the order of WireMockContainerBuilder.WithX calls to not duplicate Networks in the Configuration.

Test to reproduce

  • 1 Call WireMockContainerBuilder.WithNetwork(x);
  • 2 Call WireMockContainerBuilder.WithMappings(x) and WireMockContainerBuilder.WithWatchStaticMappings(true);
  • 3 Observe the configuration has two Networks, when only one was added.

Other related info

This was observed when updating WireMock.net. Some previous working code failed, an exception was thrown because of the duplicate Network entries in:
https://github.com/testcontainers/testcontainers-dotnet/blob/develop/src/Testcontainers/Clients/ContainerConfigurationConverter.cs at line 30.

Networks = new ToNetworks(configuration).Convert(configuration.Networks)?.ToDictionary(item => item.Key, item => item.Value);

Changing the order of the .WithX calls resolved the issue.
image

@epDugas epDugas added the bug label Dec 11, 2024
@StefH StefH self-assigned this Dec 17, 2024
@StefH
Copy link
Collaborator

StefH commented Dec 17, 2024

@epDugas
Can you please provide a full working example (console app or unit test) which shows this issue?

@epDugas
Copy link
Contributor Author

epDugas commented Dec 21, 2024

See attached for console app demonstrating issue.
dotnet_console_test.zip

@StefH
Copy link
Collaborator

StefH commented Dec 21, 2024

See attached for console app demonstrating issue. dotnet_console_test.zip

Are you using Linux or Windows containers?

@StefH
Copy link
Collaborator

StefH commented Dec 21, 2024

@epDugas
Thanks for creating this issue. Some more entries where duplicated it seems.

It should be fixed now, can you use preview version 1.6.10-ci-19504
(https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)

@epDugas
Copy link
Contributor Author

epDugas commented Dec 21, 2024

Thanks @StefH !

Are you using Linux or Windows containers?

Linux

@StefH
Copy link
Collaborator

StefH commented Dec 22, 2024

#1222

@StefH
Copy link
Collaborator

StefH commented Dec 24, 2024

@epDugas
If you have time, you can test version 1.6.10-ci-19519.

@epDugas
Copy link
Contributor Author

epDugas commented Dec 31, 2024

@epDugas If you have time, you can test version 1.6.10-ci-19519.

Verified issue resolved. Thanks @StefH !

@StefH StefH closed this as completed Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants