Open lukehesluke opened 4 years ago
Interesting... this should never happen as opportunities should not be shared between tests (the broker microservice locks each opportunity id as it is used by a test)
If an opportunity was shared between tests it would be manipulated in different ways by each test and cause expected behaviour, so the error is a good one to have spotted.
As these are controlled tests, a unique opportunity should be created for each test... in which case I'm unclear how this happened unless there were duplicate opportunities created due to a database race condition of some sort...?
@nickevansuk Thanks for the context. I've just done a bit more digging. This problem is presently on the master branch. It seems to occur on every controlled test mode tests
It may have been hidden previously, by tests failing at random mode due to the conformance cert issue (https://github.com/openactive/openactive-test-suite/issues/313).
It occurs in:
Seen in this test run:
test-output-macos-latest-controlled.zip
~~This is due to this logic in broker: https://github.com/openactive/openactive-test-suite/blob/master/packages/openactive-broker-microservice/app.js#L462. (this also occurs for orders: https://github.com/openactive/openactive-test-suite/blob/master/packages/openactive-broker-microservice/app.js#L621)~~
As tests are run in parallel, this issue is bound to ocassionally come up as multiple tests ask for the same resource at the same time.I suggest turning theresponses
andorderResponses
into "multimap"-type structures - where each entry can contain multiple{ send(json) }
objects. Then, when the appropriate object is found in the Opportunity & Order RPDE feeds, call.send(..)
on all of the values within that entrynope ☝️