@@ -406,6 +406,17 @@ mod tests {
406
406
. collect ( ) )
407
407
}
408
408
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
+
409
420
let mut conn = env. async_db ( ) . await . async_conn ( ) . await ;
410
421
let v1 = env
411
422
. fake_release ( )
@@ -427,17 +438,7 @@ mod tests {
427
438
. rustdoc_file_exists( "a" , "1.0.0" , None , "a/index.html" , archive_storage)
428
439
. await ?
429
440
) ;
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 ?) ;
441
442
let crate_id = sqlx:: query_scalar!(
442
443
r#"SELECT crate_id as "crate_id: CrateId" FROM releases WHERE id = $1"# ,
443
444
v1. 0
@@ -469,17 +470,7 @@ mod tests {
469
470
. rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
470
471
. await ?
471
472
) ;
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 ?) ;
483
474
assert_eq ! (
484
475
owners( & mut conn, crate_id) . await ?,
485
476
vec![ "Peter Rabbit" . to_string( ) ]
@@ -517,17 +508,7 @@ mod tests {
517
508
. await ?
518
509
) ;
519
510
}
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 ?) ;
531
512
532
513
assert ! ( release_exists( & mut conn, v2) . await ?) ;
533
514
assert ! (
@@ -536,17 +517,7 @@ mod tests {
536
517
. rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
537
518
. await ?
538
519
) ;
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 ?) ;
550
521
assert_eq ! (
551
522
owners( & mut conn, crate_id) . await ?,
552
523
vec![ "Peter Rabbit" . to_string( ) ]
0 commit comments