@@ -69,6 +69,8 @@ func TestPrune(t *testing.T) {
6969 safefilename := fmt .Sprintf ("db_backup_%sZ.gz" , relativeTime .Format ("2006-01-02T15-04-05" ))
7070 safefilenames = append (safefilenames , safefilename )
7171 }
72+ t .Log (filenames )
73+ t .Log (filenames [0 :2 ])
7274 tests := []struct {
7375 name string
7476 opts PruneOptions
@@ -87,6 +89,9 @@ func TestPrune(t *testing.T) {
8789 {"2 days" , PruneOptions {Retention : "2d" , Now : now }, filenames , filenames [0 :6 ], nil },
8890 // 3 weeks - file[13] is 504h+30m = 504.5h, so it should be pruned
8991 {"3 weeks" , PruneOptions {Retention : "3w" , Now : now }, filenames , filenames [0 :13 ], nil },
92+ // 2 most recent files
93+ {"2 most recent" , PruneOptions {Retention : "2c" , Now : now }, filenames , filenames [0 :2 ], nil },
94+
9095 // repeat for safe file names
9196 {"1 hour safe names" , PruneOptions {Retention : "1h" , Now : now }, safefilenames , safefilenames [0 :1 ], nil },
9297 // 2 hours - file[2] is 2h+30m = 2.5h, so it should be pruned
@@ -148,6 +153,8 @@ func TestPrune(t *testing.T) {
148153 }
149154 slices .Sort (afterFiles )
150155 slices .Sort (tt .afterFiles )
156+ t .Logf ("expected files: %v" , tt .afterFiles )
157+ t .Logf ("after files: %v" , afterFiles )
151158 assert .ElementsMatch (t , tt .afterFiles , afterFiles )
152159 })
153160 }
0 commit comments