Skip to content

Commit d9490a2

Browse files
authored
minor: skip session tests if mongocryptd fails to spawn (#888)
1 parent b6344d2 commit d9490a2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ functions:
9393
9494
export AZURE_IMDS_MOCK_PORT=44175
9595
96+
export SESSION_TEST_REQUIRE_MONGOCRYPTD=1
97+
9698
if [ "Windows_NT" != "$OS" ]; then
9799
ulimit -n 64000
98100
fi

src/test/spec/sessions.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ async fn spawn_mongocryptd(name: &str) -> Option<(EventClient, Process)> {
209209

210210
let pid_file_path = format!("--pidfilepath={name}.pid");
211211
let args = vec!["--port=47017", &pid_file_path];
212-
let process = Process::spawn("mongocryptd", args).expect("Failed to spawn mongocryptd");
212+
let Ok(process) = Process::spawn("mongocryptd", args) else {
213+
if std::env::var("SESSION_TEST_REQUIRE_MONGOCRYPTD").is_ok() {
214+
panic!("Failed to spawn mongocryptd");
215+
}
216+
log_uncaptured(format!("Skipping {name}: failed to spawn mongocryptd"));
217+
return None;
218+
};
213219

214220
let options = ClientOptions::parse("mongodb://localhost:47017")
215221
.await

0 commit comments

Comments
 (0)