[DRIVERS-2336] Add $$subType to Unified Test Format Created: 24/May/22  Updated: 24/May/22

Status: Backlog
Project: Drivers
Component/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Ezra Chung Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Driver Changes: Not Needed

 Description   

Summary

The existing $$type operator is able to assert that a given field has BSON Binary type (currently named "binData"). However, it would be even more powerful to assert the subtype of the given Binary value, which is often essential to the correctness of a given interface using Binary values.

A $$subType operator would be equivalent to $$type: binData, but also assert the subType of the given field. Its usage may look like the following:

# Current:
- name: createKey
  object: *clientEncryption0
  arguments: { kmsProvider: local }
  expectResult: { $$type: binData } # Could have any subtype.
 
# Proposed:
- name: createKey
  object: *clientEncryption0
  arguments: { kmsProvider: local }
  expectResult: { $$subType: UUID } # BSON Binary subtype 04.
 
# Alternatively (or in addition to the above):
- name: createKey
  object: *clientEncryption0
  arguments: { kmsProvider: local }
  expectResult: { $$subType: 0x04 } # Value rather than name.

Motivation

Who is the affected end user?

Drivers running unified tests to validate correctness of implementations of interfaces that involve a Binary type.

How does this affect the end user?

Adding this feature to the unified test spec does not immediately affect any current unified tests or drivers. Existing tests may be updated to use this feature. If any tests are added or updated to use this feature, drivers will then have to implement support for this new operator in order to satisfy the requirements of said tests.

How likely is it that this problem or use case will occur?

Current use of $$type to assert type binData is limited to Client Side Encryption tests. However, this feature is applicable to any context where a Binary value may be present and its subType asserted.

If the problem does occur, what are the consequences and how severe are they?

If this feature is applied to existing tests that assert type binData, it may expose bugs in a driver implementation where the subtype is incorrect despite correctly returning a Binary value.

Is this issue urgent?

It is not urgent.

Is this ticket required by a downstream team?

No.

Is this ticket only for tests?

Yes.


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