summaryrefslogtreecommitdiff
path: root/buildscripts/idl/tests/test_compatibility.py
diff options
context:
space:
mode:
authorHuayu Ouyang <huayu.ouyang@mongodb.com>2021-02-11 23:51:27 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-17 01:13:50 +0000
commit02115791f2ca7769ad9c1fe85b39c82bdc3c2d1e (patch)
treec5db11a7e7c076137208d35a1132b5fc0fbb84e3 /buildscripts/idl/tests/test_compatibility.py
parenta188378c5597afeed277034e55c94e46b60b4338 (diff)
downloadmongo-02115791f2ca7769ad9c1fe85b39c82bdc3c2d1e.tar.gz
SERVER-54145 Handle variant types in reply fields in IDL compatibility checker script
Diffstat (limited to 'buildscripts/idl/tests/test_compatibility.py')
-rw-r--r--buildscripts/idl/tests/test_compatibility.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/buildscripts/idl/tests/test_compatibility.py b/buildscripts/idl/tests/test_compatibility.py
index 7a6d3b1fd12..fdc87cb3198 100644
--- a/buildscripts/idl/tests/test_compatibility.py
+++ b/buildscripts/idl/tests/test_compatibility.py
@@ -69,7 +69,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() == 34)
+ self.assertTrue(error_collection.count() == 39)
invalid_api_version_new_error = error_collection.get_error_by_command_name(
"invalidAPIVersionNew")
@@ -255,6 +255,38 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
idl_compatibility_errors.ERROR_ID_NEW_COMMAND_TYPE_FIELD_MISSING)
self.assertRegex(str(new_type_field_missing_error), "newTypeFieldMissing")
+ new_reply_field_variant_type_error = error_collection.get_error_by_error_id(
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE)
+ self.assertRegex(str(new_reply_field_variant_type_error), "newReplyFieldVariantType")
+
+ new_reply_field_variant_not_subset_error = error_collection.get_error_by_command_name(
+ "newReplyFieldVariantNotSubset")
+ self.assertTrue(new_reply_field_variant_not_subset_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_not_subset_error), "newReplyFieldVariantNotSubset")
+
+ new_reply_field_variant_recursive_error = error_collection.get_error_by_command_name(
+ "replyFieldVariantRecursive")
+ self.assertTrue(new_reply_field_variant_recursive_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_NOT_SUBSET)
+ self.assertRegex(str(new_reply_field_variant_recursive_error), "replyFieldVariantRecursive")
+
+ new_reply_field_variant_struct_not_subset_error = error_collection.get_error_by_command_name(
+ "newReplyFieldVariantStructNotSubset")
+ self.assertTrue(new_reply_field_variant_struct_not_subset_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_error),
+ "newReplyFieldVariantStructNotSubset")
+
+ new_reply_field_variant_struct_recursive_error = error_collection.get_error_by_command_name(
+ "replyFieldVariantStructRecursive")
+ self.assertTrue(new_reply_field_variant_struct_recursive_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_COMMAND_NOT_SUBSET)
+ self.assertRegex(
+ str(new_reply_field_variant_struct_recursive_error), "replyFieldVariantStructRecursive")
+
def test_error_reply(self):
"""Tests the compatibility checker with the ErrorReply struct."""
dir_path = path.dirname(path.realpath(__file__))