@@ -406,6 +406,17 @@ mod tests {
406406 . collect ( ) )
407407 }
408408
409+ async fn json_exists ( storage : & AsyncStorage , version : & str ) -> Result < bool > {
410+ storage
411+ . exists ( & rustdoc_json_path (
412+ "a" ,
413+ version,
414+ "x86_64-unknown-linux-gnu" ,
415+ crate :: storage:: RustdocJsonFormatVersion :: Latest ,
416+ ) )
417+ . await
418+ }
419+
409420 let mut conn = env. async_db ( ) . await . async_conn ( ) . await ;
410421 let v1 = env
411422 . fake_release ( )
@@ -427,17 +438,7 @@ mod tests {
427438 . rustdoc_file_exists( "a" , "1.0.0" , None , "a/index.html" , archive_storage)
428439 . await ?
429440 ) ;
430- assert ! (
431- env. async_storage( )
432- . await
433- . exists( & rustdoc_json_path(
434- "a" ,
435- "1.0.0" ,
436- "x86_64-unknown-linux-gnu" ,
437- crate :: storage:: RustdocJsonFormatVersion :: Latest
438- ) )
439- . await ?
440- ) ;
441+ assert ! ( json_exists( & * env. async_storage( ) . await , "1.0.0" ) . await ?) ;
441442 let crate_id = sqlx:: query_scalar!(
442443 r#"SELECT crate_id as "crate_id: CrateId" FROM releases WHERE id = $1"# ,
443444 v1. 0
@@ -469,17 +470,7 @@ mod tests {
469470 . rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
470471 . await ?
471472 ) ;
472- assert ! (
473- env. async_storage( )
474- . await
475- . exists( & rustdoc_json_path(
476- "a" ,
477- "2.0.0" ,
478- "x86_64-unknown-linux-gnu" ,
479- crate :: storage:: RustdocJsonFormatVersion :: Latest
480- ) )
481- . await ?
482- ) ;
473+ assert ! ( json_exists( & * env. async_storage( ) . await , "2.0.0" ) . await ?) ;
483474 assert_eq ! (
484475 owners( & mut conn, crate_id) . await ?,
485476 vec![ "Peter Rabbit" . to_string( ) ]
@@ -517,17 +508,7 @@ mod tests {
517508 . await ?
518509 ) ;
519510 }
520- assert ! (
521- !env. async_storage( )
522- . await
523- . exists( & rustdoc_json_path(
524- "a" ,
525- "1.0.0" ,
526- "x86_64-unknown-linux-gnu" ,
527- crate :: storage:: RustdocJsonFormatVersion :: Latest
528- ) )
529- . await ?
530- ) ;
511+ assert ! ( !json_exists( & * env. async_storage( ) . await , "1.0.0" ) . await ?) ;
531512
532513 assert ! ( release_exists( & mut conn, v2) . await ?) ;
533514 assert ! (
@@ -536,17 +517,7 @@ mod tests {
536517 . rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
537518 . await ?
538519 ) ;
539- assert ! (
540- env. async_storage( )
541- . await
542- . exists( & rustdoc_json_path(
543- "a" ,
544- "2.0.0" ,
545- "x86_64-unknown-linux-gnu" ,
546- crate :: storage:: RustdocJsonFormatVersion :: Latest
547- ) )
548- . await ?
549- ) ;
520+ assert ! ( json_exists( & * env. async_storage( ) . await , "2.0.0" ) . await ?) ;
550521 assert_eq ! (
551522 owners( & mut conn, crate_id) . await ?,
552523 vec![ "Peter Rabbit" . to_string( ) ]
0 commit comments