mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Two things. $META HAS CONFORMANCE CASES NOW. The catalogue gained $slice and $elemMatch when they were implemented; $meta went in afterwards and had none, so the one part of the projection work that a live database could check was the part nothing checked. Two cases, compared differently on purpose: projection/$meta recordId COMPARE.SHAPE projection/$meta textScore full value comparison recordId is the STORAGE identity of a document, so its value is each backend's own and comparing values would report a difference that is not one. What has to agree is that every backend ANSWERS, and answers with the same shape - a number on every row - which is what SHAPE checks. Before the fix they all errored, so that is exactly the regression worth guarding. textScore is computed by the handler ABOVE the backends, from the document's own strings, so every backend must produce the same number and the values are compared in full. It is also the only case that exercises $text: only `alpha` (_id 1) carries the term, and carries it once. Sorted by _id so the comparison does not depend on the order a backend returns rows in. A TEST RUN STOPS ITS DATABASES ON EVERY WAY OUT. build.sh stopped the test server and the mongod at the END of the run - reached when the run finishes, and not reached when it is interrupted or when one of the early failures returns. Then the mongod on :3001 and the bundle server on :3000 outlive the run. That is not untidy so much as expensive, and the cost lands on the NEXT run. The harness reuses a database only when it ANSWERS - a port held by something else moves it aside - so a leftover mongod IS reused, holding a database this run never seeded, and the failures land somewhere else entirely. So the stopping is a shell function called from a trap on EXIT INT TERM, and the normal path calls the same function. It is idempotent - each half clears its PID - so the trap firing afterwards stops nothing twice, and a database this run did NOT start is still left alone, because its PID was never recorded. Conformance containers go with it: that stage names each engine's container wekan-conformance-db-<timestamp> and removes it when the engine is done, but an interrupted run leaves the one it was on, and a container still holding 5432 or 3306 fails the next run's engine before it starts. cmd has no trap, so build.bat does the same clearing on the way IN as well as on the way out: one :stop_test_databases label, called at the start and the end of both all-tests flows. Starting from a clean slate is the batch answer to a trap it cannot have. The two copies of the stopping that were already there are now that one label, so they cannot drift. tests/buildScriptParity.test.cjs pins both: the trap and the idempotence in build.sh, the four calls in build.bat, and that both stop the same two servers and the conformance containers. Thanks to xet7 !