mirror of
https://github.com/restic/restic.git
synced 2026-09-15 00:37:58 +00:00
check: Fix crash of --read-data-subset=x% on empty repository
Rounding up to at least one pack file should only be done if at least a pack file exists.
This commit is contained in:
@@ -122,3 +122,10 @@ func TestSelectRandomPacksByPercentage(t *testing.T) {
|
||||
rtest.Assert(t, ok, "Expected input and output to be equal")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectNoRandomPacksByPercentage(t *testing.T) {
|
||||
// that the a repository without pack files works
|
||||
var testPacks = make(map[restic.ID]int64)
|
||||
selectedPacks := selectRandomPacksByPercentage(testPacks, 10.0)
|
||||
rtest.Assert(t, len(selectedPacks) == 0, "Expected 0 selected packs")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user