summaryrefslogtreecommitdiff
path: root/buildscripts/idl/tests
diff options
context:
space:
mode:
authorMoustafa Maher <m.maher@10gen.com>2021-03-30 16:42:52 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-01 23:25:03 +0000
commitebe3f4d45079332827a41596283d3b6f688c8cd3 (patch)
tree2271419268c22c646b2ac4fdb9aa3b90546dff13 /buildscripts/idl/tests
parent39e9990a2fe1b72e5d776a86651469894d0d72af (diff)
downloadmongo-ebe3f4d45079332827a41596283d3b6f688c8cd3.tar.gz
SERVER-55524 Remove aborting for missing array in IDL compatibility checker
Diffstat (limited to 'buildscripts/idl/tests')
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_no_array/command_parameter_no_array.idl55
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_with_array/command_parameter_with_array.idl55
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_no_array/command_type_no_array.idl55
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_with_array/command_type_with_array.idl55
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/new/compatibility_test_fail_new.idl56
-rw-r--r--buildscripts/idl/tests/compatibility_test_fail/old/compatibility_test_fail_old.idl56
-rw-r--r--buildscripts/idl/tests/test_compatibility.py60
7 files changed, 137 insertions, 255 deletions
diff --git a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_no_array/command_parameter_no_array.idl b/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_no_array/command_parameter_no_array.idl
deleted file mode 100644
index 7a8c5dfc3ae..00000000000
--- a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_no_array/command_parameter_no_array.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2021-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-structs:
- ArrayTypeStruct:
- description: "Struct with ArrayType field."
- fields:
- ArrayCommandParameter:
- type: array<string>
-
-commands:
- ArrayCommandParameterNoArray:
- description: "command will abort because the command field type is not of ArrayType while
- the other is of ArrayType."
- command_name: arrayCommandParameterNoArray
- namespace: type
- type: array<ArrayTypeStruct>
- cpp_name: arrayCommandParameterNoArray
- strict: true
- api_version: "1"
- fields:
- parameterStruct:
- type: ArrayTypeStruct
- reply_type: ArrayTypeStruct \ No newline at end of file
diff --git a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_with_array/command_parameter_with_array.idl b/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_with_array/command_parameter_with_array.idl
deleted file mode 100644
index abe02f63150..00000000000
--- a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_parameter_with_array/command_parameter_with_array.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2021-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-structs:
- ArrayTypeStruct:
- description: "Struct with ArrayType field."
- fields:
- ArrayCommandParameter:
- type: array<string>
-
-commands:
- ArrayCommandParameterNoArray:
- description: "command will abort because the command field type of ArrayType while the other
- is not of ArrayType."
- command_name: arrayCommandParameterNoArray
- namespace: type
- type: array<ArrayTypeStruct>
- cpp_name: arrayCommandParameterNoArray
- strict: true
- api_version: "1"
- fields:
- parameterStruct:
- type: array<ArrayTypeStruct>
- reply_type: ArrayTypeStruct \ No newline at end of file
diff --git a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_no_array/command_type_no_array.idl b/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_no_array/command_type_no_array.idl
deleted file mode 100644
index 6d5302f7a2a..00000000000
--- a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_no_array/command_type_no_array.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2021-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-structs:
- ArrayTypeStruct:
- description: "Struct with ArrayType field."
- fields:
- ArrayCommandParameter:
- type: array<string>
-
-commands:
- ArrayCommandTypeErrorNoArray:
- description: "command will abort because the command type is not of ArrayType while
- the other is of ArrayType."
- command_name: arrayCommandTypeErrorNoArray
- namespace: type
- type: ArrayTypeStruct
- cpp_name: arrayCommandTypeErrorNoArray
- strict: true
- api_version: "1"
- fields:
- parameterStruct:
- type: array<ArrayTypeStruct>
- reply_type: ArrayTypeStruct \ No newline at end of file
diff --git a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_with_array/command_type_with_array.idl b/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_with_array/command_type_with_array.idl
deleted file mode 100644
index 3ede8ce9c94..00000000000
--- a/buildscripts/idl/tests/compatibility_test_fail/abort/missing_array/command_type_with_array/command_type_with_array.idl
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (C) 2021-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-structs:
- ArrayTypeStruct:
- description: "Struct with ArrayType field."
- fields:
- ArrayCommandParameter:
- type: array<string>
-
-commands:
- ArrayCommandTypeErrorNoArray:
- description: "command will abort because the command type is of ArrayType while
- the other is not of ArrayType."
- command_name: arrayCommandTypeErrorNoArray
- namespace: type
- type: array<ArrayTypeStruct>
- cpp_name: arrayCommandTypeErrorNoArray
- strict: true
- api_version: "1"
- fields:
- parameterStruct:
- type: array<ArrayTypeStruct>
- reply_type: ArrayTypeStruct \ No newline at end of file
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 2fc2640fdff..b92612556a8 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
@@ -2306,3 +2306,59 @@ commands:
strict: true
api_version: "1"
reply_type: NewlyAddedBsonSerializationTypeAnyReply
+
+ ArrayCommandTypeErrorNoArrayOld:
+ description: "command will fail because the old command type is not of ArrayType while
+ the new is of ArrayType."
+ command_name: arrayCommandTypeErrorNoArrayOld
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandTypeErrorNoArrayOld
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandTypeErrorNoArrayNew:
+ description: "command will fail because the new command type is not of ArrayType while
+ the old is of ArrayType."
+ command_name: arrayCommandTypeErrorNoArrayNew
+ namespace: type
+ type: ArrayTypeStruct
+ cpp_name: arrayCommandTypeErrorNoArrayNew
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandParameterNoArrayOld:
+ description: "command will fail because the old command field type is not of ArrayType while
+ the new is of ArrayType."
+ command_name: arrayCommandParameterNoArrayOld
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandParameterNoArrayOld
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandParameterNoArrayNew:
+ description: "command will fail because the new command field type is not of ArrayType while
+ the old is of ArrayType."
+ command_name: arrayCommandParameterNoArrayNew
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandParameterNoArrayNew
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: ArrayTypeStruct
+ reply_type: ArrayTypeStruct \ No newline at end of file
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 3064ee29b8f..4d29cdfe451 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
@@ -2289,3 +2289,59 @@ commands:
strict: true
api_version: "1"
reply_type: OkReply
+
+ ArrayCommandTypeErrorNoArrayOld:
+ description: "command will fail because the old command type is not of ArrayType while
+ the new is of ArrayType."
+ command_name: arrayCommandTypeErrorNoArrayOld
+ namespace: type
+ type: ArrayTypeStruct
+ cpp_name: arrayCommandTypeErrorNoArrayOld
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandTypeErrorNoArrayNew:
+ description: "command will fail because the new command type is not of ArrayType while
+ the old is of ArrayType."
+ command_name: arrayCommandTypeErrorNoArrayNew
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandTypeErrorNoArrayNew
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandParameterNoArrayOld:
+ description: "command will fail because the old command field type is not of ArrayType while
+ the new is of ArrayType."
+ command_name: arrayCommandParameterNoArrayOld
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandParameterNoArrayOld
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: ArrayTypeStruct
+ reply_type: ArrayTypeStruct
+
+ ArrayCommandParameterNoArrayNew:
+ description: "command will fail because the new command field type is not of ArrayType while
+ the old is of ArrayType."
+ command_name: arrayCommandParameterNoArrayNew
+ namespace: type
+ type: array<ArrayTypeStruct>
+ cpp_name: arrayCommandParameterNoArrayNew
+ strict: true
+ api_version: "1"
+ fields:
+ parameterStruct:
+ type: array<ArrayTypeStruct>
+ reply_type: ArrayTypeStruct \ No newline at end of file
diff --git a/buildscripts/idl/tests/test_compatibility.py b/buildscripts/idl/tests/test_compatibility.py
index 93da6030c14..45e429ba002 100644
--- a/buildscripts/idl/tests/test_compatibility.py
+++ b/buildscripts/idl/tests/test_compatibility.py
@@ -83,40 +83,6 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
path.join(dir_path, "compatibility_test_fail/abort/invalid_command_parameter_type"),
["src"])
- with self.assertRaises(SystemExit):
- idl_check_compatibility.check_compatibility(
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_parameter_no_array"),
- path.join(
- dir_path,
- "compatibility_test_fail/abort/missing_array/command_parameter_with_array"),
- ["src"])
-
- with self.assertRaises(SystemExit):
- idl_check_compatibility.check_compatibility(
- path.join(
- dir_path,
- "compatibility_test_fail/abort/missing_array/command_parameter_with_array"),
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_parameter_no_array"),
- ["src"])
-
- with self.assertRaises(SystemExit):
- idl_check_compatibility.check_compatibility(
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_type_no_array"),
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_type_with_array"),
- ["src"])
-
- with self.assertRaises(SystemExit):
- idl_check_compatibility.check_compatibility(
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_type_with_array"),
- path.join(dir_path,
- "compatibility_test_fail/abort/missing_array/command_type_no_array"),
- ["src"])
-
# 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."""
@@ -126,7 +92,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() == 160)
+ self.assertTrue(error_collection.count() == 164)
invalid_api_version_new_error = error_collection.get_error_by_command_name(
"invalidAPIVersionNew")
@@ -1217,6 +1183,30 @@ class TestIDLCompatibilityChecker(unittest.TestCase):
idl_compatibility_errors.ERROR_ID_ADDED_ACCESS_CHECK_FIELD)
self.assertRegex(str(added_access_check_field_error), "addedAccessCheckField")
+ missing_array_command_type_old_error = error_collection.get_error_by_command_name(
+ "arrayCommandTypeErrorNoArrayOld")
+ self.assertTrue(missing_array_command_type_old_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_TYPE_NOT_ARRAY)
+ self.assertRegex(str(missing_array_command_type_old_error), "array<ArrayTypeStruct>")
+
+ missing_array_command_type_new_error = error_collection.get_error_by_command_name(
+ "arrayCommandTypeErrorNoArrayNew")
+ self.assertTrue(missing_array_command_type_new_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_TYPE_NOT_ARRAY)
+ self.assertRegex(str(missing_array_command_type_new_error), "array<ArrayTypeStruct>")
+
+ missing_array_command_parameter_old_error = error_collection.get_error_by_command_name(
+ "arrayCommandParameterNoArrayOld")
+ self.assertTrue(missing_array_command_parameter_old_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_TYPE_NOT_ARRAY)
+ self.assertRegex(str(missing_array_command_parameter_old_error), "array<ArrayTypeStruct>")
+
+ missing_array_command_parameter_new_error = error_collection.get_error_by_command_name(
+ "arrayCommandParameterNoArrayNew")
+ self.assertTrue(missing_array_command_parameter_new_error.error_id ==
+ idl_compatibility_errors.ERROR_ID_TYPE_NOT_ARRAY)
+ self.assertRegex(str(missing_array_command_parameter_new_error), "array<ArrayTypeStruct>")
+
def test_error_reply(self):
"""Tests the compatibility checker with the ErrorReply struct."""
dir_path = path.dirname(path.realpath(__file__))