|
|
@ -193,7 +193,7 @@ fn test_find_and_modify() {
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn test_insert_failure() {
|
|
|
|
fn test_insert_failure() {
|
|
|
|
let uri = Uri::new("mongodb://localhost:27018/").unwrap(); // There should be no mongo server here
|
|
|
|
let uri = Uri::new("mongodb://localhost:27018/?serverSelectionTimeoutMS=1").unwrap(); // There should be no mongo server here
|
|
|
|
let pool = ClientPool::new(uri, None);
|
|
|
|
let pool = ClientPool::new(uri, None);
|
|
|
|
let client = pool.pop();
|
|
|
|
let client = pool.pop();
|
|
|
|
let collection = client.get_collection("rust_driver_test", "items");
|
|
|
|
let collection = client.get_collection("rust_driver_test", "items");
|
|
|
@ -202,7 +202,7 @@ fn test_insert_failure() {
|
|
|
|
let result = collection.insert(&document, None);
|
|
|
|
let result = collection.insert(&document, None);
|
|
|
|
assert!(result.is_err());
|
|
|
|
assert!(result.is_err());
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(
|
|
|
|
"MongoError (BsoncError: Stream/StreamConnect - Failed to connect to target host: localhost:27018)",
|
|
|
|
"MongoError (BsoncError: Unknown/Unknown - Timed out trying to select a server)",
|
|
|
|
format!("{:?}", result.err().unwrap())
|
|
|
|
format!("{:?}", result.err().unwrap())
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|