-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
equalToJson ignoreArrayOrder fails sometimes (version wiremock-jre8:2.25.1) #1230
Comments
the indeterministic behavior comes mainly from the test suit generating random test values and some of those will not work due to what is described below. Test case to reproduce the issue
index 0+1 and 2+3 got swapped, 4..7 are equal values
JsonDiff:
for this JsonDiff only normalized "add"+"remove" into "move" operations, but here we have a "replace" one. We probably would have expected something like
which then would work with the current code here. |
I've also opened flipkart-incubator/zjsonpatch#113 in case the compactDiffs method could be improved in a way that it returns only move operations for such cases which then would only require to update the dependency. It might not happen though and as alternative, a way to identify or hide the order in array changes would be great then. |
a simplistic approach using the sort order of the text representation of the JSON of all entries within all arrays contained, but probably not the most performant approach and also not the most performant way to write it
The first test is still failing while the others are not. |
Fixed by migration to JsonUnit in 7ead912 |
Hi tomakehurst , I need help, in my wiremock stubbing put request I am not passing some extra elements, but I am getting some extra element in response . and hence its shows Verification Exception. com.github.tomakehurst.wiremock.client.VerificationException: 3 requests were unmatched by any stub mapping. Requests are: these are the extra fields want to ignore ... Could you please tell me is there any possibility to handle that issue . |
Bug report
Which version of WireMock you're using
How you're starting and configuring WireMock, including configuration or CLI the command line
slightly "anonymized" version of the used code to create the stub
A failing test case that demonstrates the problem
The problem is a bit indeterministic as it seems and randomly fails. I tried to debug such an occurrence.
registered stub mappings (serialized as JSON):
request which was unmatched (serialized as JSON):
in
com.github.tomakehurst.wiremock.core.WireMockApp#serveStubFor
returned aServeEvent
which wasisNoExactMactch()
(no response definition configured / 404)resulting in an error log
and
as you can see, the last 2 pairs of entries in the array are swapped, but the set of values is the same -- hence ignoreArrayOrder=true should result in a positive match, but wasn't
Profiler data if the issue is performance related
not performance related as far as I can tell
The text was updated successfully, but these errors were encountered: