[DRIVERS-2238] Clarify evaluating matches Created: 18/Mar/22  Updated: 26/Jul/22  Resolved: 26/Jul/22

Status: Closed
Project: Drivers
Component/s: Unified Test Runner
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Ross Lawley Assignee: Ross Lawley
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Driver Changes: Not Needed

 Description   

Summary

Unified test format specification evaluating matches:

assert that actual does not contain additional keys

Contradicts the Crud specification extra fields in actual documents:

When comparing actual and expected documents, drivers should permit actual documents to contain additional fields not present in expected

Motivation

Who is the affected end user?

The specification implementer



 Comments   
Comment by Jeremy Mikola [ 18/Mar/22 ]

ross.lawley: The unified test format intentionally differs from previous specs. Per the pseudo-code:

if expected is not the root document:
      assert that actual does not contain additional keys

Extra fields are permitted in root documents only.

Coincidentally, this came up earlier today when aleksandr.rudo and I were discussing DRIVERS-2231 (leave $changeStream.fullDocument unset by default). I realized that the original spec tests (see: here) didn't actually provide any test coverage for the change because the change stream spec's match function only asserts keys in the expected value and ignores extra keys in actual values by design. This also applied to the related retryable reads spec tests per that legacy test runner.

That said, I wasn't too concerned about that since (a) DRIVERS-2231 is quite old and (b) this will be handled when those specs are ultimately ported to the unified test format (DRIVERS-1713, DRIVERS-1710).

If you're satisfied with this answer, feel free to resolve this issue accordingly.

Generated at Thu Feb 08 08:25:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.