WireMock-Net / WireMock.Net-docker

WireMock.Net-docker is a Docker image which runs WireMock.Net (a flexible library for stubbing and mocking web services)
MIT License
22 stars 6 forks source link

WireMock.Net Handlebars helper `Random` Fails in WireMock.Net.Testcontainers 1.6.6 #51

Closed Xor-el closed 1 month ago

Xor-el commented 1 month ago

Describe the bug

something seems to be broken in the WireMock.Net Handlebars Random helper (WireMock.Net.Testcontainers 1.6.4 was the last functional version for me).

Expected behavior:

The HandleBar Random Helper should work as expected.

Expected Data Logged on Console

=================================Starting Tests================================= Content Response = OK Content Response Content = {"rate":168} // rate can be any random integer between 150 and 300

Actual Data Logged on Console

=================================Starting Tests================================= Content Response = InternalServerError Content Response Content = {"Status":"Template references a helper that cannot be resolved. Helper 'Random'"}

Test to reproduce

Other related info

Docker is needed to run the Demo as it uses WireMock.NET Test Container.

StefH commented 1 month ago

@Xor-el Thanks for the report. It seems that the alpine docker container is broken related to Handlebars.

For now use

var container = new WireMockContainerBuilder()
.WithMappings(Helper.MappingsPath)
.WithImage("sheyenrath/wiremock.net")
.WithAutoRemove(true)
.WithCleanUp(true)
.Build();
Xor-el commented 1 month ago

Hi @StefH , your suggested workaround works, thanks.

StefH commented 1 month ago

Hi @StefH , your suggested workaround works, thanks.

In the alpine image I created a self-contained + trimmed version of WireMock, this had problems with for example loading extra dll's like Handlebars.

I'll try to release a new version for WireMock NuGets + Docker images today or tomorrow.

StefH commented 1 month ago

@Xor-el I've uploaded a fixed version for the Alpine image. All should work now.

You need to remove your latest local off-course.

Xor-el commented 1 month ago

Can confirm that this works as expected now. Thanks @StefH for the quick turnaround.