Skip to content

Commit 3e09bca

Browse files
authored
RUST-881 Run tests with requireApiVersion: 1 (#399)
1 parent 6826e0c commit 3e09bca

11 files changed

+46
-13
lines changed

.evergreen/config.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ functions:
337337
TOPOLOGY=${TOPOLOGY} \
338338
AUTH=${AUTH} \
339339
SSL=${SSL} \
340+
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
340341
sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
341342
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
342343
- command: expansions.update
@@ -355,7 +356,10 @@ functions:
355356
export SSL="${SSL}"
356357
. .evergreen/generate-uri.sh
357358
358-
SINGLE_THREAD=${SINGLE_THREAD} ASYNC_RUNTIME=${ASYNC_RUNTIME} .evergreen/run-tests.sh
359+
SINGLE_THREAD=${SINGLE_THREAD} \
360+
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
361+
MONGODB_API_VERSION=${MONGODB_API_VERSION} \
362+
.evergreen/run-tests.sh
359363
360364
"run atlas tests":
361365
- command: shell.exec
@@ -1298,6 +1302,15 @@ axes:
12981302
PYTHON: "/cygdrive/c/python/Python36/python"
12991303
VENV_BIN_DIR: "Scripts"
13001304

1305+
- id: "versioned-api"
1306+
display_name: "Versioned API"
1307+
values:
1308+
- id: require-api-v1
1309+
display_name: "Require API V1"
1310+
variables:
1311+
REQUIRE_API_VERSION: "1"
1312+
MONGODB_API_VERSION: "1"
1313+
13011314
buildvariants:
13021315
-
13031316
matrix_name: "tests"
@@ -1437,6 +1450,17 @@ buildvariants:
14371450
tasks:
14381451
- "compile-only"
14391452

1453+
- matrix_name: "versioned-api-tests"
1454+
matrix_spec:
1455+
os:
1456+
- ubuntu-18.04
1457+
async-runtime: "tokio"
1458+
versioned-api: "*"
1459+
display_name: "Versioned API ${versioned-api}"
1460+
tasks:
1461+
- ".latest .standalone"
1462+
- ".5.0 .standalone"
1463+
14401464
-
14411465
name: "lint"
14421466
display_name: "! Lint"

src/cmap/test/integration.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ async fn connection_error_during_establishment() {
179179
}
180180

181181
let options = FailCommandOptions::builder().error_code(1234).build();
182-
let failpoint = FailPoint::fail_command(&["isMaster"], FailPointMode::Times(10), Some(options));
182+
let failpoint = FailPoint::fail_command(
183+
&["isMaster", "hello"],
184+
FailPointMode::Times(10),
185+
Some(options),
186+
);
183187
let _fp_guard = client.enable_failpoint(failpoint, None).await.unwrap();
184188

185189
let handler = Arc::new(EventHandler::new());

src/sdam/test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ async fn min_heartbeat_frequency() {
5050
.app_name("SDAMMinHeartbeatFrequencyTest".to_string())
5151
.error_code(1234)
5252
.build();
53-
let failpoint = FailPoint::fail_command(&["isMaster"], FailPointMode::Times(5), fp_options);
53+
let failpoint =
54+
FailPoint::fail_command(&["isMaster", "hello"], FailPointMode::Times(5), fp_options);
5455

5556
let _fp_guard = setup_client
5657
.enable_failpoint(failpoint, None)
@@ -126,7 +127,8 @@ async fn sdam_pool_management() {
126127
.app_name("SDAMPoolManagementTest".to_string())
127128
.error_code(1234)
128129
.build();
129-
let failpoint = FailPoint::fail_command(&["isMaster"], FailPointMode::Times(1), fp_options);
130+
let failpoint =
131+
FailPoint::fail_command(&["isMaster", "hello"], FailPointMode::Times(1), fp_options);
130132

131133
let _fp_guard = client
132134
.enable_failpoint(failpoint, None)
@@ -175,7 +177,8 @@ async fn sdam_min_pool_size_error() {
175177
.app_name("SDAMMinPoolSizeErrorTest".to_string())
176178
.error_code(1234)
177179
.build();
178-
let failpoint = FailPoint::fail_command(&["isMaster"], FailPointMode::Skip(3), fp_options);
180+
let failpoint =
181+
FailPoint::fail_command(&["isMaster", "hello"], FailPointMode::Skip(3), fp_options);
179182

180183
let _fp_guard = setup_client
181184
.enable_failpoint(failpoint, None)

src/test/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ lazy_static! {
5252
std::env::var("MONGODB_URI").unwrap_or_else(|_| "mongodb://localhost:27017".to_string());
5353
pub(crate) static ref SERVER_API: Option<ServerApi> = match std::env::var("MONGODB_API_VERSION")
5454
{
55-
Ok(server_api_version) => Some(ServerApi {
55+
Ok(server_api_version) if !server_api_version.is_empty() => Some(ServerApi {
5656
version: ServerApiVersion::from_str(server_api_version.as_str()).unwrap(),
5757
deprecation_errors: None,
5858
strict: None,

src/test/spec/json/connection-monitoring-and-pooling/README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,3 @@ The following tests have not yet been automated, but MUST still be tested
226226
#. A user MUST be able to subscribe to Connection Monitoring Events in a manner idiomatic to their language and driver
227227
#. When a check out attempt fails because connection set up throws an error,
228228
assert that a ConnectionCheckOutFailedEvent with reason="connectionError" is emitted.
229-

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-maxConnecting-is-enforced.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"data": {
1616
"failCommands": [
17-
"isMaster"
17+
"isMaster",
18+
"hello"
1819
],
1920
"closeConnection": false,
2021
"blockConnection": true,

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-maxConnecting-is-enforced.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ failPoint:
1010
# high amount to ensure not interfered with by monitor checks.
1111
mode: { times: 50 }
1212
data:
13-
failCommands: ["isMaster"]
13+
failCommands: ["isMaster","hello"]
1414
closeConnection: false
1515
blockConnection: true
1616
blockTimeMS: 750

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-maxConnecting-timeout.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"data": {
1616
"failCommands": [
17-
"isMaster"
17+
"isMaster",
18+
"hello"
1819
],
1920
"closeConnection": false,
2021
"blockConnection": true,

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-maxConnecting-timeout.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ failPoint:
1010
# high amount to ensure not interfered with by monitor checks.
1111
mode: { times: 50 }
1212
data:
13-
failCommands: ["isMaster"]
13+
failCommands: ["isMaster","hello"]
1414
closeConnection: false
1515
blockConnection: true
1616
blockTimeMS: 750

src/test/spec/json/connection-monitoring-and-pooling/pool-checkout-returned-connection-maxConnecting.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"data": {
1616
"failCommands": [
17-
"isMaster"
17+
"isMaster",
18+
"hello"
1819
],
1920
"closeConnection": false,
2021
"blockConnection": true,

0 commit comments

Comments
 (0)