(t testing.TB, tx *bbolt.Tx, bk *bbolt.Bucket, bucketName string)
| 362 | } |
| 363 | |
| 364 | func createBucketAndPopulateData(t testing.TB, tx *bbolt.Tx, bk *bbolt.Bucket, bucketName string) *bbolt.Bucket { |
| 365 | if bk == nil { |
| 366 | newBucket, err := tx.CreateBucket([]byte(bucketName)) |
| 367 | require.NoError(t, err, "failed to create bucket %s", bucketName) |
| 368 | populateSampleDataInBucket(t, newBucket, rand.Intn(4096)) |
| 369 | return newBucket |
| 370 | } |
| 371 | |
| 372 | newBucket, err := bk.CreateBucket([]byte(bucketName)) |
| 373 | require.NoError(t, err, "failed to create bucket %s", bucketName) |
| 374 | populateSampleDataInBucket(t, newBucket, rand.Intn(4096)) |
| 375 | return newBucket |
| 376 | } |
| 377 | |
| 378 | func populateSampleDataInBucket(t testing.TB, bk *bbolt.Bucket, n int) { |
| 379 | var min, max = 1, 1024 |
no test coverage detected