mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
WireMock.Net TestContainer - Docker Logs contain Template references a helper that cannot be resolved. Helper Linq, only on Github Action #665
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @epDugas on GitHub (Jan 23, 2025).
Originally assigned to: @epDugas on GitHub.
Using WireMock TestContainers.
I have an integration test that is only failing when executed during a Github Action. I do not experience this issue locally. The docker log message that is related to the test failure is:
Template references a helper that cannot be resolved. Helper \u0027Linq\u0027The handlebar template string I am using is:
"{{Linq request.bodyAsJson 'it.requests.Count()'}}"The github test runner OS is:
Ubuntu
24.04.1
This test was working as of yesterday during the Github Workflow, and seems to have broke suddenly.
Any help/guidance would be greatly appreciated.
@epDugas commented on GitHub (Jan 23, 2025):
Apologies, I should have reviewed recent releases. I see that dynamic linq was disabled. Request suggestion to achieve the same as the above.
"{{Linq request.bodyAsJson 'it.requests.Count()'}}"which is to get the count of a json array contained in a property named "requests" in the request.bodyAsJson.
@epDugas commented on GitHub (Jan 25, 2025):
I submitted a PR at
Handlebars.Net.Helpersto add anEnumerable.Counthelper.I looked at adding a custom helper with
HandlebarsRegistrationCallback, but did not see a "hook" to add this to the WireMock.Net TestContainer. builder.@StefH commented on GitHub (Jan 25, 2025):
@epDugas
Thank you. I left a review comment at, https://github.com/Handlebars-Net/Handlebars.Net.Helpers/pull/113.
Can you take a look?
@StefH commented on GitHub (Jan 26, 2025):
BTW I was thinking, can't you use the
length?In handlebars.js, this does seem tot work:
https://handlebarsjs.com/playground.html
@StefH commented on GitHub (Jan 26, 2025):
Also works in Handlebars.Net
https://github.com/Handlebars-Net/Handlebars.Net.Helpers/blob/master/examples/ConsoleApp/Program.cs#L167
@StefH commented on GitHub (Jan 26, 2025):
https://github.com/WireMock-Net/WireMock.Net/pull/1245
@epDugas commented on GitHub (Jan 26, 2025):
Thanks @StefH . I tried various things and didn't have any luck. Just tried the following template string again just to verify, and didn't have any luck (the result was null). Just some additional info, I am using this in a static mapping file:
{{request.bodyAsJson.requests.length}}Request:
@StefH commented on GitHub (Jan 27, 2025):
I've just released NuGet 1.7.1 which includes your handlebars update.
And later today, I'll also release new Docker version.
@StefH commented on GitHub (Jan 27, 2025):
Docker images 1.7.1 are available.
@epDugas commented on GitHub (Jan 27, 2025):
Confirmed, closing.