Skip to content

Commit 80b34f3

Browse files
authored
RUST-395 Log skipped tests (#523)
1 parent 015c198 commit 80b34f3

File tree

29 files changed

+213
-98
lines changed

29 files changed

+213
-98
lines changed

src/client/session/test/causal_consistency.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
coll::options::CollectionOptions,
88
error::Result,
99
options::ReadConcern,
10-
test::{CommandEvent, EventClient, LOCK},
10+
test::{log_uncaptured, CommandEvent, EventClient, LOCK},
1111
ClientSession,
1212
Collection,
1313
};
@@ -150,8 +150,8 @@ async fn new_session_operation_time_null() {
150150
let client = EventClient::new().await;
151151

152152
if client.is_standalone() {
153-
println!(
154-
"skipping new_session_operation_time_null due to unsupported topology: standalone"
153+
log_uncaptured(
154+
"skipping new_session_operation_time_null due to unsupported topology: standalone",
155155
);
156156
return;
157157
}
@@ -169,8 +169,8 @@ async fn first_read_no_after_cluser_time() {
169169
let client = EventClient::new().await;
170170

171171
if client.is_standalone() {
172-
println!(
173-
"skipping first_read_no_after_cluser_time due to unsupported topology: standalone"
172+
log_uncaptured(
173+
"skipping first_read_no_after_cluser_time due to unsupported topology: standalone",
174174
);
175175
return;
176176
}
@@ -208,7 +208,7 @@ async fn first_op_update_op_time() {
208208
let client = EventClient::new().await;
209209

210210
if client.is_standalone() {
211-
println!("skipping first_op_update_op_time due to unsupported topology: standalone");
211+
log_uncaptured("skipping first_op_update_op_time due to unsupported topology: standalone");
212212
return;
213213
}
214214

@@ -258,8 +258,8 @@ async fn read_includes_after_cluster_time() {
258258
let client = EventClient::new().await;
259259

260260
if client.is_standalone() {
261-
println!(
262-
"skipping read_includes_after_cluster_time due to unsupported topology: standalone"
261+
log_uncaptured(
262+
"skipping read_includes_after_cluster_time due to unsupported topology: standalone",
263263
);
264264
return;
265265
}
@@ -303,9 +303,9 @@ async fn find_after_write_includes_after_cluster_time() {
303303
let client = EventClient::new().await;
304304

305305
if client.is_standalone() {
306-
println!(
306+
log_uncaptured(
307307
"skipping find_after_write_includes_after_cluster_time due to unsupported topology: \
308-
standalone"
308+
standalone",
309309
);
310310
return;
311311
}
@@ -345,9 +345,9 @@ async fn not_causally_consistent_omits_after_cluster_time() {
345345
let client = EventClient::new().await;
346346

347347
if client.is_standalone() {
348-
println!(
348+
log_uncaptured(
349349
"skipping not_causally_consistent_omits_after_cluster_time due to unsupported \
350-
topology: standalone"
350+
topology: standalone",
351351
);
352352
return;
353353
}
@@ -383,7 +383,7 @@ async fn omit_after_cluster_time_standalone() {
383383
let client = EventClient::new().await;
384384

385385
if !client.is_standalone() {
386-
println!("skipping omit_after_cluster_time_standalone due to unsupported topology");
386+
log_uncaptured("skipping omit_after_cluster_time_standalone due to unsupported topology");
387387
return;
388388
}
389389

@@ -418,8 +418,8 @@ async fn omit_default_read_concern_level() {
418418
let client = EventClient::new().await;
419419

420420
if client.is_standalone() {
421-
println!(
422-
"skipping omit_default_read_concern_level due to unsupported topology: standalone"
421+
log_uncaptured(
422+
"skipping omit_default_read_concern_level due to unsupported topology: standalone",
423423
);
424424
return;
425425
}
@@ -458,9 +458,9 @@ async fn test_causal_consistency_read_concern_merge() {
458458

459459
let client = EventClient::new().await;
460460
if client.is_standalone() {
461-
println!(
461+
log_uncaptured(
462462
"skipping test_causal_consistency_read_concern_merge due to unsupported topology: \
463-
standalone"
463+
standalone",
464464
);
465465
return;
466466
}
@@ -508,7 +508,7 @@ async fn omit_cluster_time_standalone() {
508508

509509
let client = EventClient::new().await;
510510
if !client.is_standalone() {
511-
println!("skipping omit_cluster_time_standalone due to unsupported topology");
511+
log_uncaptured("skipping omit_cluster_time_standalone due to unsupported topology");
512512
return;
513513
}
514514

@@ -530,7 +530,7 @@ async fn cluster_time_sent_in_commands() {
530530

531531
let client = EventClient::new().await;
532532
if client.is_standalone() {
533-
println!("skipping cluster_time_sent_in_commands due to unsupported topology");
533+
log_uncaptured("skipping cluster_time_sent_in_commands due to unsupported topology");
534534
return;
535535
}
536536

src/client/session/test/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
options::{Acknowledgment, FindOptions, ReadConcern, ReadPreference, WriteConcern},
1414
sdam::ServerInfo,
1515
selection_criteria::SelectionCriteria,
16-
test::{EventClient, TestClient, CLIENT_OPTIONS, LOCK},
16+
test::{log_uncaptured, EventClient, TestClient, CLIENT_OPTIONS, LOCK},
1717
Collection,
1818
RUNTIME,
1919
};
@@ -452,7 +452,9 @@ async fn find_and_getmore_share_session() {
452452

453453
let client = EventClient::new().await;
454454
if client.is_standalone() {
455-
println!("skipping find_and_getmore_share_session due to unsupported topology: Standalone");
455+
log_uncaptured(
456+
"skipping find_and_getmore_share_session due to unsupported topology: Standalone",
457+
);
456458
return;
457459
}
458460

src/cmap/test/integration.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ use crate::{
1212
operation::CommandResponse,
1313
sdam::ServerUpdateSender,
1414
selection_criteria::ReadPreference,
15-
test::{FailCommandOptions, FailPoint, FailPointMode, TestClient, CLIENT_OPTIONS, LOCK},
15+
test::{
16+
log_uncaptured,
17+
FailCommandOptions,
18+
FailPoint,
19+
FailPointMode,
20+
TestClient,
21+
CLIENT_OPTIONS,
22+
LOCK,
23+
},
1624
RUNTIME,
1725
};
1826
use semver::VersionReq;
@@ -79,7 +87,7 @@ async fn concurrent_connections() {
7987

8088
let mut options = CLIENT_OPTIONS.clone();
8189
if options.load_balanced.unwrap_or(false) {
82-
println!("skipping concurrent_connections test due to load-balanced topology");
90+
log_uncaptured("skipping concurrent_connections test due to load-balanced topology");
8391
return;
8492
}
8593
options.direct_connection = Some(true);
@@ -89,8 +97,8 @@ async fn concurrent_connections() {
8997
let version = VersionReq::parse(">= 4.2.9").unwrap();
9098
// blockConnection failpoint option only supported in 4.2.9+.
9199
if !version.matches(&client.server_version) {
92-
println!(
93-
"skipping concurrent_connections test due to server not supporting failpoint option"
100+
log_uncaptured(
101+
"skipping concurrent_connections test due to server not supporting failpoint option",
94102
);
95103
return;
96104
}
@@ -169,8 +177,8 @@ async fn connection_error_during_establishment() {
169177

170178
let mut client_options = CLIENT_OPTIONS.clone();
171179
if client_options.load_balanced.unwrap_or(false) {
172-
println!(
173-
"skipping connection_error_during_establishment test due to load-balanced topology"
180+
log_uncaptured(
181+
"skipping connection_error_during_establishment test due to load-balanced topology",
174182
);
175183
return;
176184
}
@@ -181,10 +189,10 @@ async fn connection_error_during_establishment() {
181189

182190
let client = TestClient::with_options(Some(client_options.clone())).await;
183191
if !client.supports_fail_command() {
184-
println!(
192+
log_uncaptured(format!(
185193
"skipping {} due to failCommand not being supported",
186194
function_name!()
187-
);
195+
));
188196
return;
189197
}
190198

@@ -236,10 +244,10 @@ async fn connection_error_during_operation() {
236244

237245
let client = TestClient::with_options(options.into()).await;
238246
if !client.supports_fail_command() {
239-
println!(
247+
log_uncaptured(format!(
240248
"skipping {} due to failCommand not being supported",
241249
function_name!()
242-
);
250+
));
243251
return;
244252
}
245253

src/cmap/test/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::{
2121
test::{
2222
assert_matches,
2323
eq_matches,
24+
log_uncaptured,
2425
run_spec_test,
2526
EventClient,
2627
MatchErrExt,
@@ -431,7 +432,10 @@ async fn cmap_spec_tests() {
431432

432433
let mut options = CLIENT_OPTIONS.clone();
433434
if options.load_balanced.unwrap_or(false) {
434-
println!("skipping due to load balanced topology");
435+
log_uncaptured(format!(
436+
"skipping {:?} due to load balanced topology",
437+
test_file.description
438+
));
435439
return;
436440
}
437441
options.hosts.drain(1..);
@@ -440,7 +444,7 @@ async fn cmap_spec_tests() {
440444
if let Some(ref run_on) = test_file.run_on {
441445
let can_run_on = run_on.iter().any(|run_on| run_on.can_run_on(&client));
442446
if !can_run_on {
443-
println!("skipping due to runOn requirements");
447+
log_uncaptured("skipping due to runOn requirements");
444448
return;
445449
}
446450
}

src/sdam/description/topology/server_selection/test/in_window.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{
1212
sdam::{description::topology::server_selection, Server},
1313
selection_criteria::ReadPreference,
1414
test::{
15+
log_uncaptured,
1516
run_spec_test,
1617
Event,
1718
EventHandler,
@@ -118,12 +119,12 @@ async fn load_balancing_test() {
118119
let mut setup_client_options = CLIENT_OPTIONS.clone();
119120

120121
if setup_client_options.load_balanced.unwrap_or(false) {
121-
println!("skipping load_balancing_test test due to load-balanced topology");
122+
log_uncaptured("skipping load_balancing_test test due to load-balanced topology");
122123
return;
123124
}
124125

125126
if setup_client_options.credential.is_some() {
126-
println!("skipping load_balancing_test test due to auth being enabled");
127+
log_uncaptured("skipping load_balancing_test test due to auth being enabled");
127128
return;
128129
}
129130

@@ -134,19 +135,19 @@ async fn load_balancing_test() {
134135
let version = VersionReq::parse(">= 4.2.9").unwrap();
135136
// blockConnection failpoint option only supported in 4.2.9+.
136137
if !version.matches(&setup_client.server_version) {
137-
println!(
138-
"skipping load_balancing_test test due to server not supporting blockConnection option"
138+
log_uncaptured(
139+
"skipping load_balancing_test test due to server not supporting blockConnection option",
139140
);
140141
return;
141142
}
142143

143144
if !setup_client.is_sharded() {
144-
println!("skipping load_balancing_test test due to topology not being sharded");
145+
log_uncaptured("skipping load_balancing_test test due to topology not being sharded");
145146
return;
146147
}
147148

148149
if CLIENT_OPTIONS.hosts.len() != 2 {
149-
println!("skipping load_balancing_test test due to topology not having 2 mongoses");
150+
log_uncaptured("skipping load_balancing_test test due to topology not having 2 mongoses");
150151
return;
151152
}
152153

src/sdam/description/topology/test/sdam.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use crate::{
2424
},
2525
selection_criteria::TagSet,
2626
test::{
27+
log_uncaptured,
2728
run_spec_test,
2829
Event,
2930
EventClient,
@@ -240,7 +241,7 @@ async fn run_test(test_file: TestFile) {
240241

241242
// TODO: RUST-360 unskip tests that rely on topology version
242243
if test_description.contains("topologyVersion") {
243-
println!("Skipping {} (RUST-360)", test_description);
244+
log_uncaptured(format!("Skipping {} (RUST-360)", test_description));
244245
return;
245246
}
246247

@@ -597,7 +598,7 @@ async fn heartbeat_events() {
597598
.await;
598599

599600
if client.is_load_balanced() {
600-
println!("skipping heartbeat_events tests due to load-balanced topology");
601+
log_uncaptured("skipping heartbeat_events tests due to load-balanced topology");
601602
return;
602603
}
603604

@@ -643,7 +644,7 @@ async fn direct_connection() {
643644

644645
let test_client = TestClient::new().await;
645646
if !test_client.is_replica_set() {
646-
println!("Skipping due to non-replica set topology");
647+
log_uncaptured("Skipping direct_connection test due to non-replica set topology");
647648
return;
648649
}
649650

0 commit comments

Comments
 (0)