Skip to content

Commit 4297b14

Browse files
add monitoring test
1 parent a82d7d8 commit 4297b14

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/client.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,4 +1119,21 @@ async fn socks5_proxy() {
11191119
))
11201120
.await
11211121
.unwrap();
1122+
1123+
// From the spec: Drivers MUST verify for at least one of the connection strings marked
1124+
// (succeeds) that command monitoring events do not reference the SOCKS5 proxy host where the
1125+
// MongoDB service server/port are referenced.
1126+
let uri = format!(
1127+
"mongodb://{mapped_host}/?proxyHost={ipv4_localhost}&proxyPort=1081&\
1128+
directConnection=true{tls}"
1129+
);
1130+
let options = ClientOptions::parse(uri).await.unwrap();
1131+
let client = Client::for_test().options(options).monitor_events().await;
1132+
client
1133+
.database("db")
1134+
.run_command(doc! { "ping": 1 })
1135+
.await
1136+
.unwrap();
1137+
let (started, _) = client.events.get_successful_command_execution("ping");
1138+
assert_eq!(&started.connection.address.to_string(), mapped_host);
11221139
}

0 commit comments

Comments
 (0)