summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-03-15 16:39:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-17 22:53:10 +0000
commit01adf14c5b921e8df8d2e0aebbc4923de5d9bb6a (patch)
tree51ab10e000b994373ea71f5d31005ac3dc365008
parent4fa2fcb16107c860448b58cd66798bae140e7263 (diff)
downloadmongo-01adf14c5b921e8df8d2e0aebbc4923de5d9bb6a.tar.gz
SERVER-55107 Adding checking for Variant containing Array Type in idl_check_compatibility
-rw-r--r--buildscripts/idl/idl_check_compatibility.py30
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl334
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl335
-rw-r--r--buildscripts/idl/tests/compatibility_test_pass/new/compatibility_test_pass_new.idl46
-rw-r--r--buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl49
-rw-r--r--buildscripts/idl/tests/test_compatibility.py220
6 files changed, 953 insertions, 61 deletions
diff --git a/buildscripts/idl/idl_check_compatibility.py b/buildscripts/idl/idl_check_compatibility.py
index e019517fd12..a7fab961ff4 100644
--- a/buildscripts/idl/idl_check_compatibility.py
+++ b/buildscripts/idl/idl_check_compatibility.py
@@ -55,7 +55,11 @@ ALLOW_ANY_TYPE_LIST: List[str] = [
"oldParamTypeBsonAnyAllowList-param-bsonTypeAnyParam",
"newParamTypeBsonAnyAllowList-param-bsonTypeAnyParam",
"commandAllowedAnyTypesWithVariant-reply-anyTypeField",
- "replyFieldTypeBsonAnyWithVariant-reply-bsonSerializationTypeAnyReplyField",
+ "replyFieldTypeBsonAnyWithVariant-reply-bsonSerializationTypeAnyStructField",
+ "replyFieldTypeBsonAnyWithVariantWithArray-reply-bsonSerializationTypeAnyStructField",
+ "parameterFieldTypeBsonAnyWithVariant-param-bsonSerializationTypeAnyStructField",
+ "parameterFieldTypeBsonAnyWithVariantWithArray-param-bsonSerializationTypeAnyStructField",
+ "commandTypeBsonAnyWithVariant", "commandTypeBsonAnyWithVariantWithArray",
"replyFieldCppTypeNotEqual-reply-cppTypeNotEqualReplyField", "commandCppTypeNotEqual",
"commandParameterCppTypeNotEqual-param-cppTypeNotEqualParam"
]
@@ -185,9 +189,9 @@ def check_reply_field_type_recursive(
for old_variant_type in old_variant_types:
if old_variant_type.name == new_variant_type.name:
# Check that the old and new version of each variant type is also compatible.
- check_reply_field_type_recursive(
- ctxt, old_variant_type, new_variant_type, cmd_name, field_name,
- old_idl_file, new_idl_file, old_idl_file_path, new_idl_file_path)
+ check_reply_field_type(ctxt, old_variant_type, new_variant_type, cmd_name,
+ field_name, old_idl_file, new_idl_file,
+ old_idl_file_path, new_idl_file_path)
break
else:
@@ -226,6 +230,11 @@ def check_reply_field_type(ctxt: IDLCompatibilityContext,
new_idl_file_path: str):
"""Check compatibility between old and new reply field type."""
# pylint: disable=too-many-arguments,too-many-branches
+ if check_array_type(ctxt, "reply_field", old_field_type, new_field_type, cmd_name, 'type',
+ old_idl_file_path, new_idl_file_path):
+ old_field_type = old_field_type.element_type
+ new_field_type = new_field_type.element_type
+
if old_field_type is None:
ctxt.add_reply_field_type_invalid_error(cmd_name, field_name, old_idl_file_path)
ctxt.errors.dump_errors()
@@ -300,11 +309,6 @@ def check_reply_field(ctxt: IDLCompatibilityContext, old_field: syntax.Field,
old_field_type = get_field_type(old_field, old_idl_file, old_idl_file_path)
new_field_type = get_field_type(new_field, new_idl_file, new_idl_file_path)
- if check_array_type(ctxt, "reply_field", old_field_type, new_field_type, cmd_name, 'type',
- old_idl_file_path, new_idl_file_path):
- old_field_type = old_field_type.element_type
- new_field_type = new_field_type.element_type
-
check_reply_field_type(ctxt, old_field_type, new_field_type, cmd_name, old_field.name,
old_idl_file, new_idl_file, old_idl_file_path, new_idl_file_path)
@@ -390,10 +394,10 @@ def check_param_or_command_type_recursive(
for new_variant_type in new_variant_types:
if old_variant_type.name == new_variant_type.name:
# Check that the old and new version of each variant type is also compatible.
- check_param_or_command_type_recursive(
- ctxt, old_variant_type, new_variant_type, cmd_name, old_idl_file,
- new_idl_file, old_idl_file_path, new_idl_file_path, param_name,
- is_command_parameter)
+ check_param_or_command_type(ctxt, old_variant_type, new_variant_type,
+ cmd_name, old_idl_file, new_idl_file,
+ old_idl_file_path, new_idl_file_path,
+ param_name, is_command_parameter)
break
else:
# old_variant_type was not found in new_variant_types.
diff --git a/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl b/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl
index 5a337aa05b0..0ebdda46d4e 100644
--- a/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl
+++ b/buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl
@@ -206,14 +206,22 @@ structs:
bsonSerializationTypeAnyReplyField:
type: bsonSerializationTypeAny
- BsonSerializationTypeWithVariantAnyReply:
- description: "This reply contains a field whose old and new variant types have a bson_serialization_type
+ BsonSerializationTypeWithVariantAnyStruct:
+ description: "This struct contains a field whose old and new variant types have a bson_serialization_type
that contains 'any' that is not compatible"
fields:
- bsonSerializationTypeAnyReplyField:
+ bsonSerializationTypeAnyStructField:
type:
variant: [oldBsonSerializationTypeAny, newBsonSerializationTypeAny]
+ BsonSerializationTypeWithVariantAnyStructWithArray:
+ description: "This struct contains a field whose old and new variant types have a array of
+ bson_serialization_type that contains 'any' that is not compatible"
+ fields:
+ bsonSerializationTypeAnyStructField:
+ type:
+ variant: [array<oldBsonSerializationTypeAny>, array<newBsonSerializationTypeAny>]
+
CppTypeNotEqualReply:
description: "This reply contains a field whose old and new type have a bson_serialization_type
that contains 'any' and the cpp_types are not equal"
@@ -258,6 +266,14 @@ structs:
type:
variant: [int, bool, string]
+ NewVariantNotSubsetReplyWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantNotSubsetReplyField:
+ type:
+ variant: [array<int>, array<bool>, array<string>]
+
NewVariantNotSubsetReplyTwo:
description: "This reply contains a field whose new variant types are not a subset
of the old variant types"
@@ -265,7 +281,15 @@ structs:
variantNotSubsetReplyFieldTwo:
type:
variant: [int, bool, string, double]
-
+
+ NewVariantNotSubsetReplyTwoWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantNotSubsetReplyFieldTwo:
+ type:
+ variant: [array<int>, array<bool>, array<string>, array<double>]
+
VariantRecursiveReply:
description: "This reply contains a field that has a new variant type that is not
compatible with the old variant type"
@@ -273,6 +297,14 @@ structs:
variantRecursiveReplyField:
type:
variant: [int, intStringToIntStringBool]
+
+ VariantRecursiveReplyWithArray:
+ description: "This reply contains a field that has a new variant type that is not
+ compatible with the old variant type"
+ fields:
+ variantRecursiveReplyField:
+ type:
+ variant: [array<int>, array<intStringToIntStringBool>]
NewVariantStructNotSubsetReply:
description: "This reply contains a field whose new variant types are not a subset
@@ -281,6 +313,14 @@ structs:
variantStructNotSubsetReplyField:
type:
variant: [int, string, StructType]
+
+ NewVariantStructNotSubsetReplyWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantStructNotSubsetReplyField:
+ type:
+ variant: [array<int>, array<string>, array<StructType>]
VariantStructRecursiveReply:
description: "This reply contains a field that has a new variant struct type that is not
@@ -289,6 +329,14 @@ structs:
variantStructRecursiveReplyField:
type:
variant: [int, StructFieldTypeRecursiveReplyTwo]
+
+ VariantStructRecursiveReplyWithArray:
+ description: "This reply contains a field that has a new variant struct type that is not
+ compatible with the old variant struct type"
+ fields:
+ variantStructRecursiveReplyField:
+ type:
+ variant: [array<int>, array<StructFieldTypeRecursiveReplyTwo>]
CommandParamStructRecursiveOne:
description: "This command parameter struct type contains an unstable field while the
@@ -360,6 +408,14 @@ structs:
type:
variant: [int, bool]
+ VariantNotSupersetStructWithArray:
+ description: "This struct contains a field where the new variant types are not a superset
+ of the old variant types"
+ fields:
+ variantNotSupersetField:
+ type:
+ variant: [array<int>, array<bool>]
+
VariantNotSupersetStructTwo:
description: "This struct contains a field where the new variant types are not a superset
of the old variant types"
@@ -368,6 +424,14 @@ structs:
type:
variant: [int, bool]
+ VariantNotSupersetStructTwoWithArray:
+ description: "This struct contains a field where the new variant types are not a superset
+ of the old variant types"
+ fields:
+ variantNotSupersetFieldTwo:
+ type:
+ variant: [array<int>, array<bool>]
+
NewTypeNotVariantStruct:
description: "This struct contains a field where the new type is not variant while the
old one is"
@@ -383,6 +447,14 @@ structs:
type:
variant: [int, intStringBoolToIntString]
+ VariantRecursiveStructWithArray:
+ description: "This struct contains a field where the new variant types are not
+ compatible with the old variant types"
+ fields:
+ variantRecursiveField:
+ type:
+ variant: [array<int>, array<intStringBoolToIntString>]
+
VariantStructNotSupersetStruct:
description: "This struct contains a field where the old variant types contains a struct
while the new one does not"
@@ -391,6 +463,14 @@ structs:
type:
variant: [int, string]
+ VariantStructNotSupersetStructWithArray:
+ description: "This struct contains a field where the old variant types contains a struct
+ while the new one does not"
+ fields:
+ variantStructNotSupersetField:
+ type:
+ variant: [array<int>, array<string>]
+
VariantStructRecursiveStruct:
description: "This struct contains a field where the old variant struct and the new
variant struct are not compatible"
@@ -399,6 +479,14 @@ structs:
type:
variant: [int, string, StructCommandParameterTypeRecursive]
+ VariantStructRecursiveStructWithArray:
+ description: "This struct contains a field where the old variant struct and the new
+ variant struct are not compatible"
+ fields:
+ variantStructRecursiveField:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterTypeRecursive>]
+
commands:
invalidAPIVersionNew:
description: "new command fails because of invalid API version"
@@ -905,7 +993,65 @@ commands:
cpp_name: replyFieldTypeBsonAnyWithVariant
strict: true
api_version: "1"
- reply_type: BsonSerializationTypeWithVariantAnyReply
+ reply_type: BsonSerializationTypeWithVariantAnyStruct
+
+ replyFieldTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its reply field variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: replyFieldTypeBsonAnyWithVariantWithArray
+ namespace: ignored
+ cpp_name: replyFieldTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: BsonSerializationTypeWithVariantAnyStructWithArray
+
+ parameterFieldTypeBsonAnyWithVariant:
+ description: "command fails when its paramter field variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: parameterFieldTypeBsonAnyWithVariant
+ namespace: ignored
+ cpp_name: parameterFieldTypeBsonAnyWithVariant
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantAnyField:
+ type: BsonSerializationTypeWithVariantAnyStruct
+
+ parameterFieldTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its parameter field variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: parameterFieldTypeBsonAnyWithVariantWithArray
+ namespace: ignored
+ cpp_name: parameterFieldTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantAnyField:
+ type: BsonSerializationTypeWithVariantAnyStructWithArray
+
+ commandTypeBsonAnyWithVariant:
+ description: "command fails when its variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: commandTypeBsonAnyWithVariant
+ namespace: type
+ type: BsonSerializationTypeWithVariantAnyStruct
+ cpp_name: commandTypeBsonAnyWithVariant
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
+ commandTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its type variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: commandTypeBsonAnyWithVariantWithArray
+ namespace: type
+ type: BsonSerializationTypeWithVariantAnyStructWithArray
+ cpp_name: commandTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
replyFieldCppTypeNotEqual:
description: "command fails because its reply field type has a bson_serialization_type
@@ -1183,6 +1329,16 @@ commands:
api_version: "1"
reply_type: NewVariantNotSubsetReply
+ newReplyFieldVariantNotSubsetWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantNotSubsetWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantNotSubsetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantNotSubsetReplyWithArray
+
newReplyFieldVariantNotSubsetTwo:
description: "new command fails because its reply field type is a variant type that is not
a subset of the old reply field variant types"
@@ -1193,6 +1349,16 @@ commands:
api_version: "1"
reply_type: NewVariantNotSubsetReplyTwo
+ newReplyFieldVariantNotSubsetTwoWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantNotSubsetTwoWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantNotSubsetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantNotSubsetReplyTwoWithArray
+
replyFieldVariantRecursive:
description: "new command fails because its reply field type is a variant type that is not
compatible with the old reply field variant type"
@@ -1203,6 +1369,16 @@ commands:
api_version: "1"
reply_type: VariantRecursiveReply
+ replyFieldVariantRecursiveWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ compatible with the old reply field variant type"
+ command_name: replyFieldVariantRecursiveWithArray
+ namespace: ignored
+ cpp_name: replyFieldVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: VariantRecursiveReplyWithArray
+
newReplyFieldVariantStructNotSubset:
description: "new command fails because its reply field type is a variant type that is not
a subset of the old reply field variant types"
@@ -1212,6 +1388,16 @@ commands:
strict: true
api_version: "1"
reply_type: NewVariantStructNotSubsetReply
+
+ newReplyFieldVariantStructNotSubsetWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantStructNotSubsetWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantStructNotSubsetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantStructNotSubsetReplyWithArray
replyFieldVariantStructRecursive:
description: "new command fails because its reply field type has a variant
@@ -1223,6 +1409,17 @@ commands:
strict: true
api_version: "1"
reply_type: VariantStructRecursiveReply
+
+ replyFieldVariantStructRecursiveWithArray:
+ description: "new command fails because its reply field type has a variant
+ struct type that is not compatible with the old reply field variant
+ struct type"
+ command_name: replyFieldVariantStructRecursiveWithArray
+ namespace: ignored
+ cpp_name: replyFieldVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: VariantStructRecursiveReplyWithArray
newParamVariantNotSuperset:
description: "new command fails because its parameter type is a variant type that is not
@@ -1238,6 +1435,20 @@ commands:
type:
variant: [int, bool]
+ newParamVariantNotSupersetWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a superset of the old parameter variant types"
+ command_name: newParamVariantNotSupersetWithArray
+ namespace: ignored
+ cpp_name: newParamVariantNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantNotSupersetParam:
+ type:
+ variant: [array<int>, array<bool>]
+
newParamVariantNotSupersetTwo:
description: "new command fails because its parameter type is a variant type that is not
a superset of the old parameter variant types"
@@ -1252,6 +1463,20 @@ commands:
type:
variant: [int, string]
+ newParamVariantNotSupersetTwoWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a superset of the old parameter variant types"
+ command_name: newParamVariantNotSupersetTwoWithArray
+ namespace: ignored
+ cpp_name: newParamVariantNotSupersetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantNotSupersetParamTwo:
+ type:
+ variant: [array<int>, array<string>]
+
newParamTypeNotVariant:
description: "new command fails because its parameter type is not variant while the old
param type is"
@@ -1279,6 +1504,20 @@ commands:
type:
variant: [int, intStringBoolToIntString]
+ newParamVariantRecursiveWithArray:
+ description: "new command fails because its param type is a variant type that is not
+ compatible with the old param variant type"
+ command_name: newParamVariantRecursiveWithArray
+ namespace: ignored
+ cpp_name: newParamVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantRecursiveParam:
+ type:
+ variant: [array<int>, array<intStringBoolToIntString>]
+
newParamVariantStructNotSuperset:
description: "new command fails because its parameter type is a variant type that is not
a subset of the old parameter variant types"
@@ -1293,6 +1532,20 @@ commands:
type:
variant: [int, string]
+ newParamVariantStructNotSupersetWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a subset of the old parameter variant types"
+ command_name: newParamVariantStructNotSupersetWithArray
+ namespace: ignored
+ cpp_name: newParamVariantStructNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantStructNotSupersetParam:
+ type:
+ variant: [array<int>, array<string>]
+
newParamVariantStructRecursive:
description: "new command fails because its parameter type has a variant
struct type that is not compatible with the old parameter variant
@@ -1308,6 +1561,21 @@ commands:
type:
variant: [int, string, StructCommandParameterTypeRecursive]
+ newParamVariantStructRecursiveWithArray:
+ description: "new command fails because its parameter type has a variant
+ struct type that is not compatible with the old parameter variant
+ struct type"
+ command_name: newParamVariantStructRecursiveWithArray
+ namespace: ignored
+ cpp_name: newParamVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantStructRecursiveParam:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterTypeRecursive>]
+
newCommandTypeVariantNotSuperset:
description: "new command fails because its type is a variant type that is not
a superset of the old type variant types"
@@ -1319,6 +1587,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantNotSupersetWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old type variant types"
+ command_name: newCommandTypeVariantNotSupersetWithArray
+ namespace: type
+ type: VariantNotSupersetStructWithArray
+ cpp_name: newCommandTypeVariantNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantNotSupersetTwo:
description: "new command fails because its type is a variant type that is not
a superset of the old command type variant types"
@@ -1330,6 +1609,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantNotSupersetTwoWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old command type variant types"
+ command_name: newCommandTypeVariantNotSupersetTwoWithArray
+ namespace: type
+ type: VariantNotSupersetStructTwoWithArray
+ cpp_name: newCommandTypeVariantNotSupersetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeNotVariant:
description: "new command fails because its type is not variant while the old
type is"
@@ -1352,6 +1642,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantRecursiveWithArray:
+ description: "new command fails because its type is a variant type that is not
+ compatible with the old command type variant type"
+ command_name: newCommandTypeVariantRecursiveWithArray
+ namespace: type
+ type: VariantRecursiveStructWithArray
+ cpp_name: newCommandTypeVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantStructNotSuperset:
description: "new command fails because its type is a variant type that is not
a superset of the old command type variant types"
@@ -1363,6 +1664,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantStructNotSupersetWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old command type variant types"
+ command_name: newCommandTypeVariantStructNotSupersetWithArray
+ namespace: type
+ type: VariantStructNotSupersetStructWithArray
+ cpp_name: newCommandTypeVariantStructNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantStructRecursive:
description: "new command fails because its type has a variant
struct type that is not compatible with the old command type variant
@@ -1375,6 +1687,18 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantStructRecursiveWithArray:
+ description: "new command fails because its type has a variant
+ struct type that is not compatible with the old command type variant
+ struct type"
+ command_name: newCommandTypeVariantStructRecursiveWithArray
+ namespace: type
+ type: VariantStructRecursiveStructWithArray
+ cpp_name: newCommandTypeVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newReplyFieldValidator:
description: "new command fails because it contains a reply field that contains a validator
that is not present in the old reply field"
diff --git a/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl b/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl
index 106fb15076b..4497b150d0a 100644
--- a/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl
+++ b/buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl
@@ -210,14 +210,23 @@ structs:
bsonSerializationTypeAnyReplyField:
type: bsonSerializationTypeAny
- BsonSerializationTypeWithVariantAnyReply:
- description: "This reply contains a field whose old and new variant types have a bson_serialization_type
+ BsonSerializationTypeWithVariantAnyStruct:
+ description: "This struct contains a field whose old and new variant types have a bson_serialization_type
that contains 'any' that is not compatible"
fields:
- bsonSerializationTypeAnyReplyField:
+ bsonSerializationTypeAnyStructField:
type:
variant: [oldBsonSerializationTypeAny, newBsonSerializationTypeAny]
+ BsonSerializationTypeWithVariantAnyStructWithArray:
+ description: "This struct contains a field whose old and new variant types have a array of
+ bson_serialization_type that contains 'any' that is not compatible"
+ fields:
+ bsonSerializationTypeAnyStructField:
+ type:
+ variant: [array<oldBsonSerializationTypeAny>,
+ array<newBsonSerializationTypeAny>]
+
CppTypeNotEqualReply:
description: "This reply contains a field whose old and new type have a bson_serialization_type
that contains 'any' and the cpp_types are not equal"
@@ -261,6 +270,14 @@ structs:
type:
variant: [int, string]
+ NewVariantNotSubsetReplyWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantNotSubsetReplyField:
+ type:
+ variant: [array<int>, array<string>]
+
NewVariantNotSubsetReplyTwo:
description: "This reply contains a field whose new variant types are not a subset
of the old variant types"
@@ -269,6 +286,14 @@ structs:
type:
variant: [int, string]
+ NewVariantNotSubsetReplyTwoWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantNotSubsetReplyFieldTwo:
+ type:
+ variant: [array<int>, array<string>]
+
VariantRecursiveReply:
description: "This reply contains a field that has a new variant type that is not
compatible with the old variant type"
@@ -277,6 +302,14 @@ structs:
type:
variant: [int, intStringToIntStringBool]
+ VariantRecursiveReplyWithArray:
+ description: "This reply contains a field that has a new variant type that is not
+ compatible with the old variant type"
+ fields:
+ variantRecursiveReplyField:
+ type:
+ variant: [array<int>, array<intStringToIntStringBool>]
+
NewVariantStructNotSubsetReply:
description: "This reply contains a field whose new variant types are not a subset
of the old variant types"
@@ -285,6 +318,14 @@ structs:
type:
variant: [int, string]
+ NewVariantStructNotSubsetReplyWithArray:
+ description: "This reply contains a field whose new variant types are not a subset
+ of the old variant types"
+ fields:
+ variantStructNotSubsetReplyField:
+ type:
+ variant: [array<int>, array<string>]
+
VariantStructRecursiveReply:
description: "This reply contains a field that has a new variant struct type that is not
compatible with the old variant struct type"
@@ -293,6 +334,14 @@ structs:
type:
variant: [int, StructFieldTypeRecursiveReplyTwo]
+ VariantStructRecursiveReplyWithArray:
+ description: "This reply contains a field that has a new variant struct type that is not
+ compatible with the old variant struct type"
+ fields:
+ variantStructRecursiveReplyField:
+ type:
+ variant: [array<int>, array<StructFieldTypeRecursiveReplyTwo>]
+
CommandParamStructRecursiveOne:
description: "This command parameter struct type contains a stable field while the
new struct field is unstable"
@@ -352,6 +401,14 @@ structs:
type:
variant: [int, bool, string]
+ VariantNotSupersetStructWithArray:
+ description: "This struct contains a field where the new variant types are not a superset
+ of the old variant types"
+ fields:
+ variantNotSupersetField:
+ type:
+ variant: [array<int>, array<bool>, array<string>]
+
VariantNotSupersetStructTwo:
description: "This struct contains a field where the new variant types are not a superset
of the old variant types"
@@ -360,6 +417,14 @@ structs:
type:
variant: [int, bool, string, double]
+ VariantNotSupersetStructTwoWithArray:
+ description: "This struct contains a field where the new variant types are not a superset
+ of the old variant types"
+ fields:
+ variantNotSupersetFieldTwo:
+ type:
+ variant: [array<int>, array<bool>, array<string>, array<double>]
+
NewTypeNotVariantStruct:
description: "This struct contains a field where the new type is not variant while the
old one is"
@@ -376,6 +441,14 @@ structs:
type:
variant: [int, intStringBoolToIntString]
+ VariantRecursiveStructWithArray:
+ description: "This struct contains a field where the new variant types are not
+ compatible with the old variant types"
+ fields:
+ variantRecursiveField:
+ type:
+ variant: [array<int>, array<intStringBoolToIntString>]
+
VariantStructNotSupersetStruct:
description: "This struct contains a field where the old variant types contains a struct
while the new one does not"
@@ -384,6 +457,14 @@ structs:
type:
variant: [int, string, StructCommandParameterType]
+ VariantStructNotSupersetStructWithArray:
+ description: "This struct contains a field where the old variant types contains a struct
+ while the new one does not"
+ fields:
+ variantStructNotSupersetField:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterType>]
+
VariantStructRecursiveStruct:
description: "This struct contains a field where the old variant struct and the new
variant struct are not compatible"
@@ -392,6 +473,14 @@ structs:
type:
variant: [int, string, StructCommandParameterTypeRecursive]
+ VariantStructRecursiveStructWithArray:
+ description: "This struct contains a field where the old variant struct and the new
+ variant struct are not compatible"
+ fields:
+ variantStructRecursiveField:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterTypeRecursive>]
+
ArrayTypeStruct:
description: "Struct with ArrayType field."
fields:
@@ -892,8 +981,66 @@ commands:
cpp_name: replyFieldTypeBsonAnyWithVariant
strict: true
api_version: "1"
- reply_type: BsonSerializationTypeWithVariantAnyReply
+ reply_type: BsonSerializationTypeWithVariantAnyStruct
+
+ replyFieldTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its reply field variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: replyFieldTypeBsonAnyWithVariantWithArray
+ namespace: ignored
+ cpp_name: replyFieldTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: BsonSerializationTypeWithVariantAnyStructWithArray
+
+ parameterFieldTypeBsonAnyWithVariant:
+ description: "command fails when its parameter field variant types have
+ bson_serialization_type 'any' that is not compatible with each other"
+ command_name: parameterFieldTypeBsonAnyWithVariant
+ namespace: ignored
+ cpp_name: parameterFieldTypeBsonAnyWithVariant
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantAnyField:
+ type: BsonSerializationTypeWithVariantAnyStruct
+
+ parameterFieldTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its parameter field variant types have
+ bson_serialization_type 'any' that is not compatible with each other"
+ command_name: parameterFieldTypeBsonAnyWithVariantWithArray
+ namespace: ignored
+ cpp_name: parameterFieldTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantAnyField:
+ type: BsonSerializationTypeWithVariantAnyStructWithArray
+ commandTypeBsonAnyWithVariant:
+ description: "command fails when its variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: commandTypeBsonAnyWithVariant
+ namespace: type
+ type: BsonSerializationTypeWithVariantAnyStruct
+ cpp_name: commandTypeBsonAnyWithVariant
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
+ commandTypeBsonAnyWithVariantWithArray:
+ description: "command fails when its type variant types have bson_serialization_type
+ 'any' that is not compatible with each other"
+ command_name: commandTypeBsonAnyWithVariantWithArray
+ namespace: type
+ type: BsonSerializationTypeWithVariantAnyStructWithArray
+ cpp_name: commandTypeBsonAnyWithVariantWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
replyFieldCppTypeNotEqual:
description: "command fails because its reply field type has a bson_serialization_type
that contains 'any', and the cpp_types are not equal"
@@ -1170,6 +1317,16 @@ commands:
api_version: "1"
reply_type: NewVariantNotSubsetReply
+ newReplyFieldVariantNotSubsetWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantNotSubsetWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantNotSubsetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantNotSubsetReplyWithArray
+
replyFieldVariantRecursive:
description: "new command fails because its reply field type is a variant type that is not
compatible with the old reply field variant type"
@@ -1180,6 +1337,16 @@ commands:
api_version: "1"
reply_type: VariantRecursiveReply
+ replyFieldVariantRecursiveWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ compatible with the old reply field variant type"
+ command_name: replyFieldVariantRecursiveWithArray
+ namespace: ignored
+ cpp_name: replyFieldVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: VariantRecursiveReplyWithArray
+
newReplyFieldVariantStructNotSubset:
description: "new command fails because its reply field type is a variant type that is not
a subset of the old reply field variant types"
@@ -1190,6 +1357,16 @@ commands:
api_version: "1"
reply_type: NewVariantStructNotSubsetReply
+ newReplyFieldVariantStructNotSubsetWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantStructNotSubsetWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantStructNotSubsetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantStructNotSubsetReplyWithArray
+
newReplyFieldVariantNotSubsetTwo:
description: "new command fails because its reply field type is a variant type that is not
a subset of the old reply field variant types"
@@ -1199,7 +1376,17 @@ commands:
strict: true
api_version: "1"
reply_type: NewVariantNotSubsetReplyTwo
-
+
+ newReplyFieldVariantNotSubsetTwoWithArray:
+ description: "new command fails because its reply field type is a variant type that is not
+ a subset of the old reply field variant types"
+ command_name: newReplyFieldVariantNotSubsetTwoWithArray
+ namespace: ignored
+ cpp_name: newReplyFieldVariantNotSubsetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: NewVariantNotSubsetReplyTwoWithArray
+
replyFieldVariantStructRecursive:
description: "new command fails because its reply field type has a variant
struct type that is not compatible with the old reply field variant
@@ -1211,6 +1398,17 @@ commands:
api_version: "1"
reply_type: VariantStructRecursiveReply
+ replyFieldVariantStructRecursiveWithArray:
+ description: "new command fails because its reply field type has a variant
+ struct type that is not compatible with the old reply field variant
+ struct type"
+ command_name: replyFieldVariantStructRecursiveWithArray
+ namespace: ignored
+ cpp_name: replyFieldVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: VariantStructRecursiveReplyWithArray
+
newParamVariantNotSuperset:
description: "new command fails because its parameter type is a variant type that is not
a superset of the old parameter variant types"
@@ -1225,6 +1423,20 @@ commands:
type:
variant: [int, bool, string]
+ newParamVariantNotSupersetWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a superset of the old parameter variant types"
+ command_name: newParamVariantNotSupersetWithArray
+ namespace: ignored
+ cpp_name: newParamVariantNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantNotSupersetParam:
+ type:
+ variant: [array<int>, array<bool>, array<string>]
+
newParamVariantNotSupersetTwo:
description: "new command fails because its parameter type is a variant type that is not
a superset of the old parameter variant types"
@@ -1239,6 +1451,20 @@ commands:
type:
variant: [int, bool, string, double]
+ newParamVariantNotSupersetTwoWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a superset of the old parameter variant types"
+ command_name: newParamVariantNotSupersetTwoWithArray
+ namespace: ignored
+ cpp_name: newParamVariantNotSupersetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantNotSupersetParamTwo:
+ type:
+ variant: [array<int>, array<bool>, array<string>, array<double>]
+
newParamTypeNotVariant:
description: "new command fails because its parameter type is not variant while the old
param type is"
@@ -1267,6 +1493,20 @@ commands:
type:
variant: [int, intStringBoolToIntString]
+ newParamVariantRecursiveWithArray:
+ description: "new command fails because its param type is a variant type that is not
+ compatible with the old param variant type"
+ command_name: newParamVariantRecursiveWithArray
+ namespace: ignored
+ cpp_name: newParamVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantRecursiveParam:
+ type:
+ variant: [array<int>, array<intStringBoolToIntString>]
+
newParamVariantStructNotSuperset:
description: "new command fails because its parameter type is a variant type that is not
a superset of the old parameter variant types"
@@ -1281,6 +1521,20 @@ commands:
type:
variant: [int, string, StructCommandParameterType]
+ newParamVariantStructNotSupersetWithArray:
+ description: "new command fails because its parameter type is a variant type that is not
+ a superset of the old parameter variant types"
+ command_name: newParamVariantStructNotSupersetWithArray
+ namespace: ignored
+ cpp_name: newParamVariantStructNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantStructNotSupersetParam:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterType>]
+
newParamVariantStructRecursive:
description: "new command fails because its parameter type has a variant
struct type that is not compatible with the old parameter variant
@@ -1296,6 +1550,21 @@ commands:
type:
variant: [int, string, StructCommandParameterTypeRecursive]
+ newParamVariantStructRecursiveWithArray:
+ description: "new command fails because its parameter type has a variant
+ struct type that is not compatible with the old parameter variant
+ struct type"
+ command_name: newParamVariantStructRecursiveWithArray
+ namespace: ignored
+ cpp_name: newParamVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+ fields:
+ variantStructRecursiveParam:
+ type:
+ variant: [array<int>, array<string>, array<StructCommandParameterTypeRecursive>]
+
newCommandTypeVariantNotSuperset:
description: "new command fails because its type is a variant type that is not
a superset of the old type variant types"
@@ -1307,6 +1576,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantNotSupersetWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old type variant types"
+ command_name: newCommandTypeVariantNotSupersetWithArray
+ namespace: type
+ type: VariantNotSupersetStructWithArray
+ cpp_name: newCommandTypeVariantNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantNotSupersetTwo:
description: "new command fails because its type is a variant type that is not
a superset of the old command type variant types"
@@ -1318,6 +1598,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantNotSupersetTwoWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old command type variant types"
+ command_name: newCommandTypeVariantNotSupersetTwoWithArray
+ namespace: type
+ type: VariantNotSupersetStructTwoWithArray
+ cpp_name: newCommandTypeVariantNotSupersetTwoWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeNotVariant:
description: "new command fails because its type is not variant while the old
type is"
@@ -1340,6 +1631,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantRecursiveWithArray:
+ description: "new command fails because its type is a variant type that is not
+ compatible with the old command type variant type"
+ command_name: newCommandTypeVariantRecursiveWithArray
+ namespace: type
+ type: VariantRecursiveStructWithArray
+ cpp_name: newCommandTypeVariantRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantStructNotSuperset:
description: "new command fails because its type is a variant type that is not
a superset of the old command type variant types"
@@ -1351,6 +1653,17 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantStructNotSupersetWithArray:
+ description: "new command fails because its type is a variant type that is not
+ a superset of the old command type variant types"
+ command_name: newCommandTypeVariantStructNotSupersetWithArray
+ namespace: type
+ type: VariantStructNotSupersetStructWithArray
+ cpp_name: newCommandTypeVariantStructNotSupersetWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newCommandTypeVariantStructRecursive:
description: "new command fails because its type has a variant
struct type that is not compatible with the old command type variant
@@ -1363,6 +1676,18 @@ commands:
api_version: "1"
reply_type: OkReply
+ newCommandTypeVariantStructRecursiveWithArray:
+ description: "new command fails because its type has a variant
+ struct type that is not compatible with the old command type variant
+ struct type"
+ command_name: newCommandTypeVariantStructRecursiveWithArray
+ namespace: type
+ type: VariantStructRecursiveStructWithArray
+ cpp_name: newCommandTypeVariantStructRecursiveWithArray
+ strict: true
+ api_version: "1"
+ reply_type: OkReply
+
newReplyFieldValidator:
description: "new command fails because it contains a reply field that contains a validator
that is not present in the old reply field"
diff --git a/buildscripts/idl/tests/compatibility_test_pass/new/compatibility_test_pass_new.idl b/buildscripts/idl/tests/compatibility_test_pass/new/compatibility_test_pass_new.idl
index accb2e7c43e..17ea5d6fc0e 100644
--- a/buildscripts/idl/tests/compatibility_test_pass/new/compatibility_test_pass_new.idl
+++ b/buildscripts/idl/tests/compatibility_test_pass/new/compatibility_test_pass_new.idl
@@ -184,7 +184,7 @@ structs:
fields:
variantSubsetReplyField:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
NewVariantSubsetReplyTwo:
description: "This reply contains a field whose new variant types are a subset
@@ -192,7 +192,7 @@ structs:
fields:
variantSubsetReplyFieldTwo:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
VariantRecursiveReply:
description: "This reply contains a field that has a new variant type that is compatible
@@ -200,7 +200,8 @@ structs:
fields:
variantRecursiveReplyField:
type:
- variant: [int, intStringBoolToIntString]
+ variant: [int, intStringBoolToIntString,
+ array<intStringBoolToIntString>, array<string>]
OldVariantStructReply:
description: "This reply contains a field whose new variant type does not have a variant
@@ -208,7 +209,7 @@ structs:
fields:
variantStructReplyField:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
VariantStructRecursiveReply:
description: "This reply contains a field that has a new variant struct type that is
@@ -216,7 +217,8 @@ structs:
fields:
variantStructRecursiveReplyField:
type:
- variant: [int, StructFieldTypeRecursiveReplyTwo]
+ variant: [int, StructFieldTypeRecursiveReplyTwo,
+ array<StructFieldTypeRecursiveReplyTwo>, array<string>]
CommandParamStructRecursiveOne:
description: "This command parameter struct type contains a stable and optional
@@ -302,7 +304,7 @@ structs:
fields:
variantSupersetField:
type:
- variant: [int, bool, string]
+ variant: [int, bool, string, array<string>]
VariantSupersetStructTwo:
description: "This struct contains a field where the new variant types are a superset
@@ -310,7 +312,7 @@ structs:
fields:
variantSupersetFieldTwo:
type:
- variant: [int, bool, string, double]
+ variant: [int, bool, string, double, array<string>]
OldTypeNotVariantStruct:
description: "This struct contains a field where the new type is variant while the
@@ -318,7 +320,7 @@ structs:
fields:
variantField:
type:
- variant: [int, bool]
+ variant: [int, bool, array<string>]
VariantRecursiveStruct:
description: "This struct contains a field where the new variant types are
@@ -326,7 +328,8 @@ structs:
fields:
variantRecursiveField:
type:
- variant: [int, intStringToIntStringBool]
+ variant: [int, intStringToIntStringBool,
+ array<intStringToIntStringBool>, array<string>]
VariantStructSupersetStruct:
description: "This struct contains a field where the new variant types contains a struct
@@ -334,7 +337,8 @@ structs:
fields:
variantStructSupersetField:
type:
- variant: [int, string, NewCommandParameterStruct]
+ variant: [int, string, NewCommandParameterStruct,
+ array<NewCommandParameterStruct>, array<string>]
VariantStructRecursiveStruct:
description: "This struct contains a field where the old variant struct and the new
@@ -342,7 +346,8 @@ structs:
fields:
variantStructRecursiveField:
type:
- variant: [int, string, StructCommandParameterTypeRecursive]
+ variant: [int, string, StructCommandParameterTypeRecursive,
+ array<StructCommandParameterTypeRecursive>, array<string>]
BsonSerializationTypeAnyReply:
description: "This reply contains a field whose type is 'any' and is explicitly allowed"
@@ -356,7 +361,9 @@ structs:
fields:
anyTypeField:
type:
- variant: [bsonSerializationTypeAnyAllowed, StructFieldTypeRecursiveReplyTwo]
+ variant: [bsonSerializationTypeAnyAllowed, StructFieldTypeRecursiveReplyTwo,
+ array<bsonSerializationTypeAnyAllowed>,
+ array<StructFieldTypeRecursiveReplyTwo>]
ArrayTypeStruct:
description: "Struct with ArrayType field."
@@ -927,7 +934,7 @@ commands:
fields:
variantSupersetParam:
type:
- variant: [int, bool, string]
+ variant: [int, bool, string, array<string>]
newParamVariantSupersetTwo:
description: "new command passes because its parameter type is a variant type that is
@@ -941,7 +948,7 @@ commands:
fields:
variantSupersetParam:
type:
- variant: [int, string, bool, double]
+ variant: [int, string, bool, double, array<string>]
oldParamTypeNotVariant:
description: "new command passes because its parameter type is variant while the old
@@ -955,7 +962,7 @@ commands:
fields:
variantParam:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
newParamVariantRecursive:
description: "new command passes because its param type is a variant type that is
@@ -969,7 +976,8 @@ commands:
fields:
variantRecursiveParam:
type:
- variant: [int, intStringToIntStringBool]
+ variant: [int, intStringToIntStringBool,
+ array<intStringToIntStringBool>, array<string>]
newParamVariantStructSuperset:
description: "new command passes because its parameter type is a variant type that is
@@ -983,7 +991,8 @@ commands:
fields:
variantStructSupersetParam:
type:
- variant: [int, string, NewCommandParameterStruct]
+ variant: [int, string, NewCommandParameterStruct,
+ array<NewCommandParameterStruct>, array<string>]
newParamVariantStructRecursive:
description: "new command passes because its parameter type has a variant
@@ -998,7 +1007,8 @@ commands:
fields:
variantStructRecursiveParam:
type:
- variant: [int, string, StructCommandParameterTypeRecursive]
+ variant: [int, string, StructCommandParameterTypeRecursive,
+ array<StructCommandParameterTypeRecursive>, array<string>]
newCommandTypeVariantSuperset:
description: "new command passes because its type is a variant type that is
diff --git a/buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl b/buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl
index 795141862de..bfc678f4971 100644
--- a/buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl
+++ b/buildscripts/idl/tests/compatibility_test_pass/old/compatibility_test_pass_old.idl
@@ -175,7 +175,7 @@ structs:
fields:
oldVariantTypeReplyField:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
NewVariantSubsetReply:
description: "This reply contains a field whose new variant types are a subset
@@ -183,7 +183,7 @@ structs:
fields:
variantSubsetReplyField:
type:
- variant: [int, bool, string]
+ variant: [int, bool, string, array<string>]
NewVariantSubsetReplyTwo:
description: "This reply contains a field whose new variant types are a subset
@@ -191,7 +191,7 @@ structs:
fields:
variantSubsetReplyFieldTwo:
type:
- variant: [int, string, bool, double]
+ variant: [int, string, bool, double, array<string>]
VariantRecursiveReply:
description: "This reply contains a field that has a new variant type that is compatible
@@ -199,7 +199,8 @@ structs:
fields:
variantRecursiveReplyField:
type:
- variant: [int, intStringBoolToIntString]
+ variant: [int, intStringBoolToIntString,
+ array<intStringBoolToIntString>, array<string>]
OldVariantStructReply:
description: "This reply contains a field whose new variant type does not have a variant
@@ -207,7 +208,7 @@ structs:
fields:
variantStructReplyField:
type:
- variant: [int, string, StructType]
+ variant: [int, string, StructType, array<StructType>, array<string>]
VariantStructRecursiveReply:
description: "This reply contains a field that has a new variant struct type that is
@@ -215,7 +216,8 @@ structs:
fields:
variantStructRecursiveReplyField:
type:
- variant: [int, StructFieldTypeRecursiveReplyTwo]
+ variant: [int, StructFieldTypeRecursiveReplyTwo,
+ array<StructFieldTypeRecursiveReplyTwo>, array<string>]
NewCommandParameterStruct:
description: "The new command parameter's type and the
@@ -299,7 +301,7 @@ structs:
fields:
variantSupersetField:
type:
- variant: [int, bool]
+ variant: [int, bool, array<string>]
VariantSupersetStructTwo:
description: "This struct contains a field where the new variant types are a superset
@@ -307,7 +309,7 @@ structs:
fields:
variantSupersetFieldTwo:
type:
- variant: [int, bool]
+ variant: [int, bool, array<string>]
OldTypeNotVariantStruct:
description: "This struct contains a field where the new type is variant while the
@@ -322,7 +324,8 @@ structs:
fields:
variantRecursiveField:
type:
- variant: [int, intStringToIntStringBool]
+ variant: [int, intStringToIntStringBool,
+ array<intStringToIntStringBool>, array<string>]
VariantStructSupersetStruct:
description: "This struct contains a field where the new variant types contains a struct
@@ -330,7 +333,8 @@ structs:
fields:
variantStructSupersetField:
type:
- variant: [int, string, NewCommandParameterStruct]
+ variant: [int, string, NewCommandParameterStruct,
+ array<NewCommandParameterStruct>, array<string>]
VariantStructRecursiveStruct:
description: "This struct contains a field where the old variant struct and the new
@@ -338,7 +342,8 @@ structs:
fields:
variantStructRecursiveField:
type:
- variant: [int, string, StructCommandParameterTypeRecursive]
+ variant: [int, string, StructCommandParameterTypeRecursive,
+ array<StructCommandParameterTypeRecursive>, array<string>]
BsonSerializationTypeAnyReply:
description: "This reply contains a field whose type is 'any' and is explicitly allowed"
@@ -352,7 +357,12 @@ structs:
fields:
anyTypeField:
type:
- variant: [intStringBoolToIntString, bsonSerializationTypeAnyAllowed, StructFieldTypeRecursiveReplyTwo]
+ variant: [intStringBoolToIntString,
+ bsonSerializationTypeAnyAllowed,
+ StructFieldTypeRecursiveReplyTwo,
+ array<intStringBoolToIntString>,
+ array<bsonSerializationTypeAnyAllowed>,
+ array<StructFieldTypeRecursiveReplyTwo>]
ArrayTypeStruct:
description: "Struct with ArrayType field."
@@ -923,7 +933,7 @@ commands:
fields:
variantSupersetParam:
type:
- variant: [int, bool, string]
+ variant: [int, bool, string, array<string>]
newParamVariantSupersetTwo:
description: "new command passes because its parameter type is a variant type that is
@@ -937,7 +947,7 @@ commands:
fields:
variantSupersetParam:
type:
- variant: [int, string, bool, double]
+ variant: [int, string, bool, double, array<string>]
oldParamTypeNotVariant:
description: "new command passes because its parameter type is variant while the old
@@ -951,7 +961,7 @@ commands:
fields:
variantParam:
type:
- variant: [int, string]
+ variant: [int, string, array<string>]
newParamVariantRecursive:
description: "new command passes because its param type is a variant type that is
@@ -965,7 +975,8 @@ commands:
fields:
variantRecursiveParam:
type:
- variant: [int, intStringToIntStringBool]
+ variant: [int, intStringToIntStringBool,
+ array<intStringToIntStringBool>, array<string>]
newParamVariantStructSuperset:
description: "new command passes because its parameter type is a variant type that is
@@ -979,7 +990,8 @@ commands:
fields:
variantStructSupersetParam:
type:
- variant: [int, string, NewCommandParameterStruct]
+ variant: [int, string, NewCommandParameterStruct,
+ array<NewCommandParameterStruct>, array<string>]
newParamVariantStructRecursive:
description: "new command passes because its parameter type has a variant
@@ -994,7 +1006,8 @@ commands:
fields:
variantStructRecursiveParam:
type:
- variant: [int, string, StructCommandParameterTypeRecursive]
+ variant: [int, string, StructCommandParameterTypeRecursive,
+ array<StructCommandParameterTypeRecursive>, array<string>]
newCommandTypeVariantSuperset:
description: "new command passes because its type is a variant type that is
diff --git a/buildscripts/idl/tests/test_compatibility.py b/buildscripts/idl/tests/test_compatibility.py
index 43faba8b43f..d17b289fb2e 100644
--- a/buildscripts/idl/tests/test_compatibility.py
+++ b/buildscripts/idl/tests/test_compatibility.py
@@ -117,7 +117,7 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
"compatibility_test_fail/abort/missing_array/command_type_no_array"),
["src"])
- # pylint: disable=too-many-locals,too-many-statements
+ # pylint: disable=too-many-locals,too-many-statements,invalid-name
def test_should_fail(self):
"""Tests that incompatible old and new IDL commands should fail."""
dir_path = path.dirname(path.realpath(__file__))
@@ -126,7 +126,7 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
path.join(dir_path, "compatibility_test_fail/new"), ["src"])
self.assertTrue(error_collection.has_errors())
- self.assertTrue(error_collection.count() == 100)
+ self.assertTrue(error_collection.count() == 128)
invalid_api_version_new_error = error_collection.get_error_by_command_name(
"invalidAPIVersionNew")
@@ -410,6 +410,104 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
self.assertRegex(
str(reply_field_type_bson_any_with_variant_error), "replyFieldTypeBsonAnyWithVariant")
+ reply_field_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "replyFieldTypeBsonAnyWithVariantWithArray",
+ idl_compatibility_errors.ERROR_ID_OLD_REPLY_FIELD_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ reply_field_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_OLD_REPLY_FIELD_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(reply_field_type_bson_any_with_variant_with_array_error),
+ "replyFieldTypeBsonAnyWithVariantWithArray")
+
+ reply_field_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "replyFieldTypeBsonAnyWithVariantWithArray",
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ reply_field_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(reply_field_type_bson_any_with_variant_with_array_error),
+ "replyFieldTypeBsonAnyWithVariantWithArray")
+
+ parameter_field_type_bson_any_with_variant_error = error_collection.get_error_by_command_name_and_error_id(
+ "parameterFieldTypeBsonAnyWithVariant", idl_compatibility_errors.
+ ERROR_ID_OLD_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ parameter_field_type_bson_any_with_variant_error.error_id == idl_compatibility_errors.
+ ERROR_ID_OLD_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(parameter_field_type_bson_any_with_variant_error),
+ "parameterFieldTypeBsonAnyWithVariant")
+
+ parameter_field_type_bson_any_with_variant_error = error_collection.get_error_by_command_name_and_error_id(
+ "parameterFieldTypeBsonAnyWithVariant", idl_compatibility_errors.
+ ERROR_ID_NEW_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ parameter_field_type_bson_any_with_variant_error.error_id == idl_compatibility_errors.
+ ERROR_ID_NEW_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(parameter_field_type_bson_any_with_variant_error),
+ "parameterFieldTypeBsonAnyWithVariant")
+
+ parameter_field_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "parameterFieldTypeBsonAnyWithVariantWithArray", idl_compatibility_errors.
+ ERROR_ID_OLD_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(parameter_field_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.
+ ERROR_ID_OLD_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(parameter_field_type_bson_any_with_variant_with_array_error),
+ "parameterFieldTypeBsonAnyWithVariantWithArray")
+
+ parameter_field_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "parameterFieldTypeBsonAnyWithVariantWithArray", idl_compatibility_errors.
+ ERROR_ID_NEW_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(parameter_field_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.
+ ERROR_ID_NEW_COMMAND_PARAMETER_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(parameter_field_type_bson_any_with_variant_with_array_error),
+ "parameterFieldTypeBsonAnyWithVariantWithArray")
+
+ command_type_bson_any_with_variant_error = error_collection.get_error_by_command_name_and_error_id(
+ "commandTypeBsonAnyWithVariant",
+ idl_compatibility_errors.ERROR_ID_OLD_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ command_type_bson_any_with_variant_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_OLD_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(command_type_bson_any_with_variant_error), "commandTypeBsonAnyWithVariant")
+
+ command_type_bson_any_with_variant_error = error_collection.get_error_by_command_name_and_error_id(
+ "commandTypeBsonAnyWithVariant",
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ command_type_bson_any_with_variant_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(command_type_bson_any_with_variant_error), "commandTypeBsonAnyWithVariant")
+
+ command_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "commandTypeBsonAnyWithVariantWithArray",
+ idl_compatibility_errors.ERROR_ID_OLD_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ command_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_OLD_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(command_type_bson_any_with_variant_with_array_error),
+ "commandTypeBsonAnyWithVariantWithArray")
+
+ command_type_bson_any_with_variant_with_array_error = error_collection.get_error_by_command_name_and_error_id(
+ "commandTypeBsonAnyWithVariantWithArray",
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertTrue(
+ command_type_bson_any_with_variant_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_TYPE_BSON_SERIALIZATION_TYPE_ANY)
+ self.assertRegex(
+ str(command_type_bson_any_with_variant_with_array_error),
+ "commandTypeBsonAnyWithVariantWithArray")
+
reply_field_cpp_type_not_equal_error = error_collection.get_error_by_command_name(
"replyFieldCppTypeNotEqual")
self.assertTrue(reply_field_cpp_type_not_equal_error.error_id ==
@@ -582,6 +680,45 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
self.assertRegex(
str(new_reply_field_variant_struct_recursive_error), "replyFieldVariantStructRecursive")
+ new_reply_field_variant_not_subset_with_array_error = error_collection.get_error_by_command_name(
+ "newReplyFieldVariantNotSubsetWithArray")
+ self.assertTrue(new_reply_field_variant_not_subset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_not_subset_with_array_error),
+ "newReplyFieldVariantNotSubsetWithArray")
+
+ new_reply_field_variant_not_subset_with_array_two_errors = error_collection.get_all_errors_by_command_name(
+ "newReplyFieldVariantNotSubsetTwoWithArray")
+ self.assertTrue(len(new_reply_field_variant_not_subset_with_array_two_errors) == 2)
+ for error in new_reply_field_variant_not_subset_with_array_two_errors:
+ self.assertTrue(error.error_id == idl_compatibility_errors.
+ ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE_NOT_SUBSET)
+
+ new_reply_field_variant_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "replyFieldVariantRecursiveWithArray")
+ self.assertTrue(new_reply_field_variant_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_REPLY_FIELD_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_recursive_with_array_error),
+ "replyFieldVariantRecursiveWithArray")
+
+ new_reply_field_variant_struct_not_subset_with_array_error = error_collection.get_error_by_command_name(
+ "newReplyFieldVariantStructNotSubsetWithArray")
+ self.assertTrue(new_reply_field_variant_struct_not_subset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_struct_not_subset_with_array_error),
+ "newReplyFieldVariantStructNotSubsetWithArray")
+
+ new_reply_field_variant_struct_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "replyFieldVariantStructRecursiveWithArray")
+ self.assertTrue(new_reply_field_variant_struct_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_REPLY_FIELD_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_struct_recursive_with_array_error),
+ "replyFieldVariantStructRecursiveWithArray")
+
new_command_parameter_contains_validator_error = error_collection.get_error_by_command_name(
"newCommandParameterValidator")
self.assertTrue(new_command_parameter_contains_validator_error.error_id ==
@@ -750,6 +887,85 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
self.assertRegex(
str(new_simple_action_types_not_subset_error), "newSimpleActionTypesNotSubset")
+ new_param_variant_not_superset_with_array_error = error_collection.get_error_by_command_name(
+ "newParamVariantNotSupersetWithArray")
+ self.assertTrue(
+ new_param_variant_not_superset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_PARAMETER_VARIANT_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_param_variant_not_superset_with_array_error),
+ "newParamVariantNotSupersetWithArray")
+
+ new_param_variant_not_superset_with_array_two_errors = error_collection.get_all_errors_by_command_name(
+ "newParamVariantNotSupersetTwoWithArray")
+ self.assertTrue(len(new_param_variant_not_superset_with_array_two_errors) == 2)
+ for error in new_param_variant_not_superset_with_array_two_errors:
+ self.assertTrue(error.error_id == idl_compatibility_errors.
+ ERROR_ID_NEW_COMMAND_PARAMETER_VARIANT_TYPE_NOT_SUPERSET)
+
+ new_param_variant_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "newParamVariantRecursiveWithArray")
+ self.assertTrue(new_param_variant_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_PARAMETER_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_param_variant_recursive_with_array_error), "newParamVariantRecursiveWithArray")
+
+ new_param_variant_struct_not_superset_with_array_error = error_collection.get_error_by_command_name(
+ "newParamVariantStructNotSupersetWithArray")
+ self.assertTrue(
+ new_param_variant_struct_not_superset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_PARAMETER_VARIANT_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_param_variant_struct_not_superset_with_array_error),
+ "newParamVariantStructNotSupersetWithArray")
+
+ new_param_variant_struct_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "newParamVariantStructRecursiveWithArray")
+ self.assertTrue(new_param_variant_struct_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_PARAMETER_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_param_variant_struct_recursive_with_array_error),
+ "newParamVariantStructRecursiveWithArray")
+
+ new_command_type_variant_not_superset_with_array_error = error_collection.get_error_by_command_name(
+ "newCommandTypeVariantNotSupersetWithArray")
+ self.assertTrue(new_command_type_variant_not_superset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_VARIANT_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_command_type_variant_not_superset_with_array_error),
+ "newCommandTypeVariantNotSupersetWithArray")
+
+ new_command_type_variant_not_superset_with_array_two_errors = error_collection.get_all_errors_by_command_name(
+ "newCommandTypeVariantNotSupersetTwoWithArray")
+ self.assertTrue(len(new_command_type_variant_not_superset_with_array_two_errors) == 2)
+ for error in new_command_type_variant_not_superset_with_array_two_errors:
+ self.assertTrue(error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_VARIANT_TYPE_NOT_SUPERSET)
+
+ new_command_type_variant_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "newCommandTypeVariantRecursiveWithArray")
+ self.assertTrue(new_command_type_variant_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_command_type_variant_recursive_with_array_error),
+ "newCommandTypeVariantRecursiveWithArray")
+
+ new_command_type_variant_struct_not_superset_with_array_error = error_collection.get_error_by_command_name(
+ "newCommandTypeVariantStructNotSupersetWithArray")
+ self.assertTrue(new_command_type_variant_struct_not_superset_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_COMMAND_VARIANT_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_command_type_variant_struct_not_superset_with_array_error),
+ "newCommandTypeVariantStructNotSupersetWithArray")
+
+ new_command_type_variant_struct_recursive_with_array_error = error_collection.get_error_by_command_name(
+ "newCommandTypeVariantStructRecursiveWithArray")
+ self.assertTrue(new_command_type_variant_struct_recursive_with_array_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_TYPE_NOT_SUPERSET)
+ self.assertRegex(
+ str(new_command_type_variant_struct_recursive_with_array_error),
+ "newCommandTypeVariantStructRecursiveWithArray")
+
def test_error_reply(self):
"""Tests the compatibility checker with the ErrorReply struct."""
dir_path = path.dirname(path.realpath(__file__))