File tree Expand file tree Collapse file tree 4 files changed +24
-13
lines changed Expand file tree Collapse file tree 4 files changed +24
-13
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ use crate::test::{run_spec_test_with_path, LOCK};
22
33use 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) ]
77async 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 } )
Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments