Skip to content

Commit 93842d0

Browse files
committed
panic if nonsensical numChunks
1 parent 4de9c7c commit 93842d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/verifier/recheck.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package verifier
22

33
import (
44
"context"
5+
"fmt"
56

67
"github.com/10gen/migration-verifier/internal/retry"
78
"github.com/10gen/migration-verifier/internal/types"
@@ -63,6 +64,10 @@ func (verifier *Verifier) InsertFailedCompareRecheckDocs(
6364
// This will split the given slice into *roughly* the given number of chunks.
6465
// It may end up being more or fewer, but it should be pretty close.
6566
func splitToChunks[T any, Slice ~[]T](elements Slice, numChunks int) []Slice {
67+
if numChunks < 1 {
68+
panic(fmt.Sprintf("numChunks (%v) should be >=1", numChunks))
69+
}
70+
6671
elsPerChunk := len(elements) / numChunks
6772

6873
if elsPerChunk == 0 {

0 commit comments

Comments
 (0)