@@ -11,7 +11,7 @@ use super::{CrateId, update_latest_version_id};
11
11
12
12
/// List of directories in docs.rs's underlying storage (either the database or S3) containing a
13
13
/// subdirectory named after the crate. Those subdirectories will be deleted.
14
- static LIBRARY_STORAGE_PATHS_TO_DELETE : & [ & str ] = & [ "rustdoc" , "sources" ] ;
14
+ static LIBRARY_STORAGE_PATHS_TO_DELETE : & [ & str ] = & [ "rustdoc" , "rustdoc-json" , " sources"] ;
15
15
static OTHER_STORAGE_PATHS_TO_DELETE : & [ & str ] = & [ "sources" ] ;
16
16
17
17
#[ derive( Debug , thiserror:: Error ) ]
@@ -222,6 +222,7 @@ mod tests {
222
222
use super :: * ;
223
223
use crate :: db:: ReleaseId ;
224
224
use crate :: registry_api:: { CrateOwner , OwnerKind } ;
225
+ use crate :: storage:: rustdoc_json_path;
225
226
use crate :: test:: { async_wrapper, fake_release_that_failed_before_build} ;
226
227
use test_case:: test_case;
227
228
@@ -405,6 +406,17 @@ mod tests {
405
406
. collect ( ) )
406
407
}
407
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
+
408
420
let mut conn = env. async_db ( ) . await . async_conn ( ) . await ;
409
421
let v1 = env
410
422
. fake_release ( )
@@ -426,6 +438,7 @@ mod tests {
426
438
. rustdoc_file_exists( "a" , "1.0.0" , None , "a/index.html" , archive_storage)
427
439
. await ?
428
440
) ;
441
+ assert ! ( json_exists( & * env. async_storage( ) . await , "1.0.0" ) . await ?) ;
429
442
let crate_id = sqlx:: query_scalar!(
430
443
r#"SELECT crate_id as "crate_id: CrateId" FROM releases WHERE id = $1"# ,
431
444
v1. 0
@@ -457,6 +470,7 @@ mod tests {
457
470
. rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
458
471
. await ?
459
472
) ;
473
+ assert ! ( json_exists( & * env. async_storage( ) . await , "2.0.0" ) . await ?) ;
460
474
assert_eq ! (
461
475
owners( & mut conn, crate_id) . await ?,
462
476
vec![ "Peter Rabbit" . to_string( ) ]
@@ -494,13 +508,16 @@ mod tests {
494
508
. await ?
495
509
) ;
496
510
}
511
+ assert ! ( !json_exists( & * env. async_storage( ) . await , "1.0.0" ) . await ?) ;
512
+
497
513
assert ! ( release_exists( & mut conn, v2) . await ?) ;
498
514
assert ! (
499
515
env. async_storage( )
500
516
. await
501
517
. rustdoc_file_exists( "a" , "2.0.0" , None , "a/index.html" , archive_storage)
502
518
. await ?
503
519
) ;
520
+ assert ! ( json_exists( & * env. async_storage( ) . await , "2.0.0" ) . await ?) ;
504
521
assert_eq ! (
505
522
owners( & mut conn, crate_id) . await ?,
506
523
vec![ "Peter Rabbit" . to_string( ) ]
0 commit comments