11use anyhow:: Result ;
2+ use bytesize:: ByteSize ;
23use jiff:: Span ;
34use rstest:: rstest;
45
56use rustic_core:: {
6- BackupOptions , CheckOptions , LimitOption , PathList , PruneOptions , repofile:: SnapshotFile ,
7+ BackupOptions , CheckOptions , ConfigOptions , LimitOption , PathList , PruneOptions ,
8+ repofile:: { Chunker , SnapshotFile } ,
79} ;
810
911use super :: { RepoOpen , TestSource , set_up_repo, tar_gz_testdata} ;
@@ -12,16 +14,25 @@ use super::{RepoOpen, TestSource, set_up_repo, tar_gz_testdata};
1214fn test_prune (
1315 tar_gz_testdata : Result < TestSource > ,
1416 set_up_repo : Result < RepoOpen > ,
17+ #[ values(
18+ ConfigOptions :: default ( ) ,
19+ ConfigOptions :: default ( )
20+ . set_chunker( Chunker :: FixedSize )
21+ . set_chunk_size( ByteSize :: b( 2 ) )
22+ ) ]
23+ opts : ConfigOptions ,
1524 #[ values( true , false ) ] instant_delete : bool ,
1625 #[ values(
1726 LimitOption :: Percentage ( 0 ) ,
1827 LimitOption :: Percentage ( 50 ) ,
1928 LimitOption :: Unlimited
2029 ) ]
2130 max_unused : LimitOption ,
31+ #[ values( true , false ) ] fast_repack : bool ,
2232) -> Result < ( ) > {
2333 // Fixtures
24- let ( source, repo) = ( tar_gz_testdata?, set_up_repo?. to_indexed_ids ( ) ?) ;
34+ let ( source, mut repo) = ( tar_gz_testdata?, set_up_repo?. to_indexed_ids ( ) ?) ;
35+ _ = repo. apply_config ( & opts) ?;
2536
2637 let opts = BackupOptions :: default ( ) ;
2738
@@ -49,7 +60,8 @@ fn test_prune(
4960 let prune_opts = PruneOptions :: default ( )
5061 . instant_delete ( instant_delete)
5162 . max_unused ( max_unused)
52- . keep_delete ( Span :: default ( ) ) ;
63+ . keep_delete ( Span :: default ( ) )
64+ . fast_repack ( fast_repack) ;
5365 let plan = repo. prune_plan ( & prune_opts) ?;
5466 // TODO: Snapshot-test the plan (currently doesn't impl Serialize)
5567 // assert_ron_snapshot!("prune", plan);
0 commit comments