fix: prevent integer overflow

pull/16022/head
Edd Robinson 2019-11-22 14:06:21 +00:00
parent 2f86815f83
commit 0999f88273
2 changed files with 3 additions and 3 deletions

View File

@ -174,7 +174,7 @@ func BenchmarkKVStore_Bucket_Cursor(b *testing.B) {
const sourceFile = "kvdata/keys.txt"
func fillBucket(t testing.TB, s *inmem.KVStore, bucket string, lines int) {
func fillBucket(t testing.TB, s *inmem.KVStore, bucket string, lines int64) {
t.Helper()
err := s.Update(context.Background(), func(tx kv.Tx) error {
b, err := tx.Bucket([]byte(bucket))
@ -189,7 +189,7 @@ func fillBucket(t testing.TB, s *inmem.KVStore, bucket string, lines int) {
defer f.Close()
if lines == 0 {
lines = math.MaxInt64
lines = int64(math.MaxInt64)
}
scan := bufio.NewScanner(bufio.NewReader(f))

View File

@ -217,7 +217,7 @@ func TestRetentionService(t *testing.T) {
gotMatched := map[string]struct{}{}
engine.DeleteBucketRangeFn = func(ctx context.Context, orgID, bucketID influxdb.ID, from, to int64) error {
if from != math.MinInt64 {
t.Fatalf("got from %d, expected %d", from, math.MinInt64)
t.Fatalf("got from %d, expected %d", from, int64(math.MinInt64))
}
wantTo := now.Add(-3 * time.Hour).UnixNano()
if to != wantTo {