Details
-
New Feature
-
Resolution: Unresolved
-
Minor - P4
-
None
-
None
-
None
-
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.