Skip to content

Commit

Permalink
snappr: Improve correctness test input coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Nov 16, 2023
1 parent 649f523 commit 3a64a06
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions snappr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,20 @@ func pruneCorrectness(snapshots []time.Time, policy Policy) error {
}

/**
* Add an increasing number of snapshots at a time (if the first few
* work fine wrt the prune consistency checks, it's unlikely that adding
* more will cause issues, so there's no need to do it one at a time --
* if a later check fails, this can always be changed back to
* incrementing it one at a time to figure out exactly what caused the
* failure).
* Add an increasing number of snapshots at a time (if the first 2k and
* last 50 work fine wrt the prune consistency checks, it's unlikely
* that adding more will fail differently, so there's no need to do it
* one at a time -- if a middle check fails, this can always be changed
* back to incrementing it one at a time to figure out exactly what
* caused the failure).
*/
nextSubset := min(subset+i*i*2, len(allSnapshots)-1)
if prevSubset == nextSubset {
var nextSubset int
if subset > 2000 && subset+50 < len(allSnapshots) {
nextSubset = subset + len(allSnapshots)/75
} else {
nextSubset = subset + 1
}
if nextSubset = min(nextSubset, len(allSnapshots)-1); prevSubset == nextSubset {
break // we've checked everything
}
prevNeed = need
Expand Down

0 comments on commit 3a64a06

Please sign in to comment.