Skip to content

Commit 3fe25b8

Browse files
authored
CXX-1848 Add sharded cluster test coverage to EVG config (#1007)
* Move legacy transaction spec tests into subdirectory * Sync legacy transaction spec tests with 56454749 (CXX-2406) * Sync legacy transactions convenient API spec tests with e9280056 (CXX-1976) * Remove references to obsolete "sharded-replicaset" topology * Fix inconsistent behavior of index_view::create_*() on sharded clusters * The failCommand operation on mongos requires 4.1+ * Multi-document transactions require 4.2+ * Fix legacy test runner outcome checks missing readPreference=primary * Fix flaky tailable await cursors tests due to extreme maxAwaitTimeMS * Remove unused configureFailPoint operation in legacy test runner * Ensure configureFailPoint events are ignored * Improve apm_checker::print_all() output and const-correctness * Capture APM events in result assertion failures * Use Catch2 substring matcher instead of index comparison * Fix operation name match for assertSessionUnpinned * Update session pin assertion operations * Do not assume session object name when not session0 * Add transactions mongos pinning prose tests * Improve failure messages for APM event checks in legacy test runner * Add Catch2 sections separating legacy transactions and convenient API tests * Handle client errors reported as logic_error in legacy test runner * Skip legacy transactions test requiring explicit readPreference with runCommand * Update legacy transactions test runner to conform to latest spec * Implement assertSessionTransactionState in legacy test runner * Implement targetedFailPoint in legacy test runner * Sync unified transaction spec tests with 474ddfcc (CXX-2221, CXX-2233, CXX-2235, CXX-2393, CXX-2552, CXX-2690) * Fix unified test runner outcome checks missing readPreference=primary and readConcern=local * Add transactions spec tests to unified test runner * Fix test client URI hostname specification in unified test runner * Implement targetedFailPoint in unified test runner * Implement session pin assertions in unified test runner * Add sharded cluster tasks to EVG config * Use scope guards to disable fail points in unified test runner * Remove obsolete version checks in examples (CXX-1547) * Fix server version comparisons * Workaround possibly unexpected multi and upsert fields * Fix match actions when comparing APM events in legacy test runner * Add support for missing sessionOptions fields in legacy test runner
1 parent 7b01ed2 commit 3fe25b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2034
-380
lines changed

.mci.yml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ functions:
476476
export RETRYABLE_READS_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-reads/unified"
477477
export RETRYABLE_WRITES_UNIFIED_TESTS_PATH="$(pwd)/../data/retryable-writes/unified"
478478
export SESSION_UNIFIED_TESTS_PATH="$(pwd)/../data/sessions/unified"
479-
export TRANSACTIONS_TESTS_PATH="$(pwd)/../data/transactions"
479+
export TRANSACTIONS_LEGACY_TESTS_PATH="$(pwd)/../data/transactions/legacy"
480+
export TRANSACTIONS_UNIFIED_TESTS_PATH="$(pwd)/../data/transactions/unified"
480481
export UNIFIED_FORMAT_TESTS_PATH=$(pwd)/../data/unified-format
481482
export URI_OPTIONS_TESTS_PATH="$(pwd)/../data/uri-options"
482483
export VERSIONED_API_TESTS_PATH=$(pwd)/../data/versioned-api
@@ -988,6 +989,21 @@ tasks:
988989
- func: "install_c_driver"
989990
- func: "test"
990991

992+
- name: compile_and_test_with_shared_libs_sharded_cluster
993+
commands:
994+
- func: "setup"
995+
- func: "start_mongod"
996+
vars:
997+
TOPOLOGY: "sharded_cluster"
998+
- func: "fetch_c_driver_source"
999+
- func: "compile"
1000+
vars:
1001+
RUN_DISTCHECK: 1
1002+
- func: "clone_drivers-evergreen-tools"
1003+
- func: "run_kms_servers"
1004+
- func: "install_c_driver"
1005+
- func: "test"
1006+
9911007
# Auto downloading the C driver in the C++ build does not currently include
9921008
# support for libmongocrypt, therefore it is not configured with
9931009
# -DENABLE_CLIENT_SIDE_ENCRYPTION=ON. For now, CSFLE tests will need to have
@@ -1006,6 +1022,20 @@ tasks:
10061022
- func: "run_kms_servers"
10071023
- func: "test"
10081024

1025+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
1026+
commands:
1027+
- func: "setup"
1028+
- func: "start_mongod"
1029+
vars:
1030+
TOPOLOGY: "sharded_cluster"
1031+
- func: "install_c_driver"
1032+
- func: "compile"
1033+
vars:
1034+
RUN_DISTCHECK: 1
1035+
- func: "clone_drivers-evergreen-tools"
1036+
- func: "run_kms_servers"
1037+
- func: "test"
1038+
10091039
- name: uninstall_check
10101040
commands:
10111041
- func: "setup"
@@ -1314,6 +1344,12 @@ buildvariants:
13141344
tasks:
13151345
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
13161346

1347+
- matrix_name: "integration (sharded cluster)"
1348+
matrix_spec: {os: "ubuntu-1804", mongodb_version: "*"}
1349+
display_name: "${os} sharded cluster (MongoDB ${mongodb_version})"
1350+
tasks:
1351+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
1352+
13171353
- matrix_name: "auth"
13181354
matrix_spec: {os: "*", mongodb_version: "latest"}
13191355
display_name: "${os} ${mongodb_version} Auth"
@@ -1327,15 +1363,6 @@ buildvariants:
13271363
- name: test_versioned_api
13281364
- name: test_versioned_api_accept_version_two
13291365

1330-
# Add matrix for specification test requirement of mongocryptd:
1331-
# "Drivers MUST run all tests with mongocryptd on at least one platform for all tested server versions (4.2+)."
1332-
- matrix_name: "mongocryptd"
1333-
matrix_spec: {os: "ubuntu-1804", mongodb_version: ["4.2", "4.4", "5.0", "latest"], use_mongocryptd: "true"}
1334-
display_name: "${os} (MongoDB ${mongodb_version}) with mongocryptd"
1335-
tasks:
1336-
- name: compile_and_test_with_shared_libs
1337-
- name: compile_and_test_with_shared_libs_replica_set
1338-
13391366
#######################################
13401367
# Linux Buildvariants #
13411368
#######################################
@@ -1358,6 +1385,7 @@ buildvariants:
13581385
- name: compile_and_test_with_static_libs
13591386
- name: compile_and_test_with_static_libs_extra_alignment
13601387
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1388+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
13611389
- name: build_example_with_add_subdirectory
13621390
distros:
13631391
- rhel90-large
@@ -1381,6 +1409,7 @@ buildvariants:
13811409
- name: compile_and_test_with_static_libs
13821410
- name: compile_and_test_with_static_libs_extra_alignment
13831411
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1412+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
13841413
- name: build_example_with_add_subdirectory
13851414
distros:
13861415
- rhel90-arm64-large
@@ -1403,6 +1432,7 @@ buildvariants:
14031432
- name: compile_and_test_with_static_libs
14041433
- name: compile_and_test_with_static_libs_extra_alignment
14051434
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1435+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
14061436
- name: build_example_with_add_subdirectory
14071437
distros:
14081438
- debian11-large
@@ -1426,6 +1456,7 @@ buildvariants:
14261456
- name: compile_and_test_with_static_libs
14271457
- name: compile_and_test_with_static_libs_extra_alignment
14281458
- name: compile_and_test_with_shared_libs_replica_set
1459+
- name: compile_and_test_with_shared_libs_sharded_cluster
14291460
- name: build_example_with_add_subdirectory
14301461
distros:
14311462
- debian11-large
@@ -1447,6 +1478,7 @@ buildvariants:
14471478
- name: compile_and_test_with_static_libs
14481479
- name: compile_and_test_with_static_libs_extra_alignment
14491480
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1481+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
14501482
- name: build_example_with_add_subdirectory
14511483
distros:
14521484
- debian10-large
@@ -1468,6 +1500,7 @@ buildvariants:
14681500
- name: compile_and_test_with_static_libs
14691501
- name: compile_and_test_with_static_libs_extra_alignment
14701502
- name: compile_and_test_with_shared_libs_replica_set
1503+
- name: compile_and_test_with_shared_libs_sharded_cluster
14711504
- name: build_example_with_add_subdirectory
14721505
distros:
14731506
- debian10-large
@@ -1479,11 +1512,11 @@ buildvariants:
14791512
matrix_spec:
14801513
os: "ubuntu-1804"
14811514
mongodb_version: ["4.2", "4.4", "5.0", "latest"]
1515+
use_mongocryptd: "true"
14821516
display_name: "${os} (MongoDB ${mongodb_version}) with mongocryptd"
14831517
tasks:
14841518
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1485-
expansions:
1486-
use_mongocryptd: true
1519+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
14871520

14881521
- name: ubuntu2004-release-latest
14891522
display_name: "Ubuntu 20.04 Release (MongoDB Latest)"
@@ -1501,6 +1534,7 @@ buildvariants:
15011534
- name: compile_and_test_with_static_libs
15021535
- name: compile_and_test_with_static_libs_extra_alignment
15031536
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1537+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
15041538
- name: build_example_with_add_subdirectory
15051539
distros:
15061540
- ubuntu2004-large
@@ -1522,6 +1556,7 @@ buildvariants:
15221556
- name: compile_and_test_with_static_libs
15231557
- name: compile_and_test_with_static_libs_extra_alignment
15241558
- name: compile_and_test_with_shared_libs_replica_set
1559+
- name: compile_and_test_with_shared_libs_sharded_cluster
15251560
- name: build_example_with_add_subdirectory
15261561
distros:
15271562
- ubuntu2004-large
@@ -1544,6 +1579,7 @@ buildvariants:
15441579
- name: compile_and_test_with_static_libs
15451580
- name: compile_and_test_with_static_libs_extra_alignment
15461581
- name: compile_and_test_with_shared_libs_replica_set_with_libmongocrypt
1582+
- name: compile_and_test_with_shared_libs_sharded_cluster_with_libmongocrypt
15471583
- name: build_example_with_add_subdirectory
15481584
distros:
15491585
- ubuntu1804-build
@@ -1565,6 +1601,7 @@ buildvariants:
15651601
- name: compile_and_test_with_static_libs
15661602
- name: compile_and_test_with_static_libs_extra_alignment
15671603
- name: compile_and_test_with_shared_libs_replica_set
1604+
- name: compile_and_test_with_shared_libs_sharded_cluster
15681605
- name: build_example_with_add_subdirectory
15691606
distros:
15701607
- ubuntu1804-build
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

data/transactions/error-labels.json renamed to data/transactions/legacy/error-labels.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"minServerVersion": "4.1.8",
1111
"topology": [
1212
"sharded"
13-
]
13+
],
14+
"serverless": "forbid"
1415
}
1516
],
1617
"database_name": "transaction-tests",
@@ -102,7 +103,7 @@
102103
}
103104
},
104105
{
105-
"description": "NotMaster errors contain transient label",
106+
"description": "NotWritablePrimary errors contain transient label",
106107
"failPoint": {
107108
"configureFailPoint": "failCommand",
108109
"mode": {
@@ -962,12 +963,12 @@
962963
"failCommands": [
963964
"commitTransaction"
964965
],
966+
"errorLabels": [
967+
"RetryableWriteError"
968+
],
965969
"writeConcernError": {
966970
"code": 91,
967-
"errmsg": "Replication is being shut down",
968-
"errorLabels": [
969-
"RetryableWriteError"
970-
]
971+
"errmsg": "Replication is being shut down"
971972
}
972973
}
973974
},
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.0",
5+
"topology": [
6+
"replicaset"
7+
]
8+
},
9+
{
10+
"minServerVersion": "4.1.8",
11+
"topology": [
12+
"sharded"
13+
]
14+
}
15+
],
16+
"database_name": "transaction-tests",
17+
"collection_name": "test",
18+
"data": [],
19+
"tests": [
20+
{
21+
"description": "Client side error in command starting transaction",
22+
"operations": [
23+
{
24+
"name": "startTransaction",
25+
"object": "session0"
26+
},
27+
{
28+
"name": "updateOne",
29+
"object": "collection",
30+
"arguments": {
31+
"session": "session0",
32+
"filter": {
33+
"_id": 1
34+
},
35+
"update": {
36+
"x": 1
37+
}
38+
},
39+
"error": true
40+
},
41+
{
42+
"name": "assertSessionTransactionState",
43+
"object": "testRunner",
44+
"arguments": {
45+
"session": "session0",
46+
"state": "starting"
47+
}
48+
}
49+
]
50+
},
51+
{
52+
"description": "Client side error when transaction is in progress",
53+
"operations": [
54+
{
55+
"name": "startTransaction",
56+
"object": "session0"
57+
},
58+
{
59+
"name": "insertOne",
60+
"object": "collection",
61+
"arguments": {
62+
"session": "session0",
63+
"document": {
64+
"_id": 1
65+
}
66+
},
67+
"result": {
68+
"insertedId": 1
69+
}
70+
},
71+
{
72+
"name": "updateOne",
73+
"object": "collection",
74+
"arguments": {
75+
"session": "session0",
76+
"filter": {
77+
"_id": 1
78+
},
79+
"update": {
80+
"x": 1
81+
}
82+
},
83+
"error": true
84+
},
85+
{
86+
"name": "assertSessionTransactionState",
87+
"object": "testRunner",
88+
"arguments": {
89+
"session": "session0",
90+
"state": "in_progress"
91+
}
92+
}
93+
]
94+
}
95+
]
96+
}
File renamed without changes.
File renamed without changes.

data/transactions/mongos-pin-auto.json renamed to data/transactions/legacy/mongos-pin-auto.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "4.1.8",
55
"topology": [
66
"sharded"
7-
]
7+
],
8+
"serverless": "forbid"
89
}
910
],
1011
"database_name": "transaction-tests",

data/transactions/mongos-recovery-token.json renamed to data/transactions/legacy/mongos-recovery-token.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "4.1.8",
55
"topology": [
66
"sharded"
7-
]
7+
],
8+
"serverless": "forbid"
89
}
910
],
1011
"database_name": "transaction-tests",
@@ -179,6 +180,9 @@
179180
"failCommands": [
180181
"commitTransaction"
181182
],
183+
"errorLabels": [
184+
"RetryableWriteError"
185+
],
182186
"writeConcernError": {
183187
"code": 91,
184188
"errmsg": "Replication is being shut down"
@@ -303,7 +307,8 @@
303307
"data": {
304308
"failCommands": [
305309
"commitTransaction",
306-
"isMaster"
310+
"isMaster",
311+
"hello"
307312
],
308313
"closeConnection": true
309314
}

data/transactions/pin-mongos.json renamed to data/transactions/legacy/pin-mongos.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"minServerVersion": "4.1.8",
55
"topology": [
66
"sharded"
7-
]
7+
],
8+
"serverless": "forbid"
89
}
910
],
1011
"database_name": "transaction-tests",
@@ -875,7 +876,7 @@
875876
"failCommands": [
876877
"commitTransaction"
877878
],
878-
"errorCode": 50
879+
"errorCode": 51
879880
}
880881
}
881882
}
@@ -887,7 +888,7 @@
887888
"errorLabelsOmit": [
888889
"TransientTransactionError"
889890
],
890-
"errorCode": 50
891+
"errorCode": 51
891892
}
892893
},
893894
{
@@ -1106,7 +1107,8 @@
11061107
"data": {
11071108
"failCommands": [
11081109
"insert",
1109-
"isMaster"
1110+
"isMaster",
1111+
"hello"
11101112
],
11111113
"closeConnection": true
11121114
}
File renamed without changes.

0 commit comments

Comments
 (0)