Skip to content

Commit b62098d

Browse files
cleanup
1 parent d30a991 commit b62098d

File tree

4 files changed

+24
-13
lines changed

4 files changed

+24
-13
lines changed

src/gridfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ impl GridFsBucket {
328328
.read_concern(self.read_concern().cloned())
329329
.selection_criteria(self.selection_criteria().cloned())
330330
.build();
331+
331332
let file = match self
332333
.inner
333334
.files
@@ -342,6 +343,7 @@ impl GridFsBucket {
342343
.into());
343344
}
344345
};
346+
345347
self.download_to_tokio_writer_common(file, destination)
346348
.await
347349
}
@@ -392,8 +394,6 @@ impl GridFsBucket {
392394
let mut n = 0;
393395
while cursor.advance().await? {
394396
let chunk = cursor.deserialize_current()?;
395-
dbg!("{}", &chunk);
396-
dbg!("{}", &file);
397397
if chunk.n != n {
398398
return Err(ErrorKind::GridFS {
399399
message: format!("missing chunk {} in file", n),
@@ -414,7 +414,7 @@ impl GridFsBucket {
414414
.into());
415415
}
416416

417-
destination.write(&chunk.data.bytes).await?;
417+
destination.write_all(&chunk.data.bytes).await?;
418418
n += 1;
419419
}
420420

src/test/spec/gridfs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::test::{run_spec_test_with_path, LOCK};
22

33
use super::{run_unified_format_test_filtered, unified_runner::TestCase};
44

5-
#[cfg_attr(feature = "tokio-runtime", tokio::test(flavor = "multi_thread"))] // multi_thread required for FailPoint
5+
#[cfg_attr(feature = "tokio-runtime", tokio::test)]
66
#[cfg_attr(feature = "async-std-runtime", async_std::test)]
77
async fn run() {
8-
let _guard = LOCK.run_exclusively().await;
8+
let _guard = LOCK.run_concurrently().await;
99
run_spec_test_with_path(&["gridfs"], |path, f| {
1010
run_unified_format_test_filtered(path, f, test_predicate)
1111
})

src/test/spec/unified_runner/matcher.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,23 @@ fn special_operator_matches(
315315
let id = value.as_str().unwrap();
316316
entity_matches(id, actual, entities.unwrap())
317317
}
318-
"$$matchesHexBytes" => {
319-
let expected = value.as_str().unwrap().to_string().to_lowercase();
320-
let actual = actual.unwrap().as_str().unwrap().to_string().to_lowercase();
321-
assert_eq!(actual, expected);
322-
Ok(())
323-
}
318+
"$$matchesHexBytes" => match (actual, value) {
319+
(Some(Bson::String(actual)), Bson::String(expected)) => {
320+
if actual.to_lowercase() == expected.to_lowercase() {
321+
Ok(())
322+
} else {
323+
Err(format!(
324+
"hex bytes do not match: expected {:?} but got {:?}",
325+
actual, expected
326+
))
327+
}
328+
}
329+
(actual, expected) => Err(format!(
330+
"actual and expected should both be BSON strings but got: actual {:?}, expected \
331+
{:?}",
332+
actual, expected
333+
)),
334+
},
324335
"$$sessionLsid" => match entities {
325336
Some(entity_map) => {
326337
let session_id = value.as_str().unwrap();

src/test/spec/unified_runner/operation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,8 +2661,8 @@ impl TestOperation for Download {
26612661
bucket
26622662
.download_to_futures_0_3_writer(self.id.clone(), &mut buf)
26632663
.await?;
2664-
let writer_data = hex::encode(buf);
2665-
Ok(Some(Entity::Bson(writer_data.into())))
2664+
let data = hex::encode(buf);
2665+
Ok(Some(Entity::Bson(data.into())))
26662666
}
26672667
.boxed()
26682668
}

0 commit comments

Comments
 (0)