[#1510] metabase/test: Fix BenchmarkListWithCursor
All checks were successful
DCO action / DCO (pull_request) Successful in 4m10s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m53s
Tests and linters / gopls check (pull_request) Successful in 5m9s
Build / Build Components (pull_request) Successful in 5m36s
Tests and linters / Lint (pull_request) Successful in 6m0s
Tests and linters / Tests (pull_request) Successful in 6m4s
Tests and linters / Run gofumpt (pull_request) Successful in 6m5s
Vulncheck / Vulncheck (pull_request) Successful in 6m48s
Tests and linters / Tests with -race (pull_request) Successful in 7m35s
Tests and linters / Staticcheck (pull_request) Successful in 7m42s
Tests and linters / Staticcheck (push) Successful in 3m50s
Tests and linters / gopls check (push) Successful in 3m57s
Build / Build Components (push) Successful in 4m30s
Tests and linters / Lint (push) Successful in 4m50s
Tests and linters / Run gofumpt (push) Successful in 5m38s
Vulncheck / Vulncheck (push) Successful in 6m51s
Pre-commit hooks / Pre-commit (push) Successful in 7m27s
Tests and linters / Tests (push) Successful in 7m45s
Tests and linters / Tests with -race (push) Successful in 8m26s
All checks were successful
DCO action / DCO (pull_request) Successful in 4m10s
Pre-commit hooks / Pre-commit (pull_request) Successful in 4m53s
Tests and linters / gopls check (pull_request) Successful in 5m9s
Build / Build Components (pull_request) Successful in 5m36s
Tests and linters / Lint (pull_request) Successful in 6m0s
Tests and linters / Tests (pull_request) Successful in 6m4s
Tests and linters / Run gofumpt (pull_request) Successful in 6m5s
Vulncheck / Vulncheck (pull_request) Successful in 6m48s
Tests and linters / Tests with -race (pull_request) Successful in 7m35s
Tests and linters / Staticcheck (pull_request) Successful in 7m42s
Tests and linters / Staticcheck (push) Successful in 3m50s
Tests and linters / gopls check (push) Successful in 3m57s
Build / Build Components (push) Successful in 4m30s
Tests and linters / Lint (push) Successful in 4m50s
Tests and linters / Run gofumpt (push) Successful in 5m38s
Vulncheck / Vulncheck (push) Successful in 6m51s
Pre-commit hooks / Pre-commit (push) Successful in 7m27s
Tests and linters / Tests (push) Successful in 7m45s
Tests and linters / Tests with -race (push) Successful in 8m26s
- Fix misplaced `(*DB).Close` (broken after47dcfa20f3
) - Use `errors.Is` for error checking (broken afterfcdbf5e509
) Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
2af3409d39
commit
8ba9f31fca
1 changed files with 3 additions and 2 deletions
|
@ -18,6 +18,8 @@ import (
|
||||||
|
|
||||||
func BenchmarkListWithCursor(b *testing.B) {
|
func BenchmarkListWithCursor(b *testing.B) {
|
||||||
db := listWithCursorPrepareDB(b)
|
db := listWithCursorPrepareDB(b)
|
||||||
|
defer func() { require.NoError(b, db.Close(context.Background())) }()
|
||||||
|
|
||||||
b.Run("1 item", func(b *testing.B) {
|
b.Run("1 item", func(b *testing.B) {
|
||||||
benchmarkListWithCursor(b, db, 1)
|
benchmarkListWithCursor(b, db, 1)
|
||||||
})
|
})
|
||||||
|
@ -33,7 +35,6 @@ func listWithCursorPrepareDB(b *testing.B) *meta.DB {
|
||||||
db := newDB(b, meta.WithMaxBatchSize(1), meta.WithBoltDBOptions(&bbolt.Options{
|
db := newDB(b, meta.WithMaxBatchSize(1), meta.WithBoltDBOptions(&bbolt.Options{
|
||||||
NoSync: true,
|
NoSync: true,
|
||||||
})) // faster single-thread generation
|
})) // faster single-thread generation
|
||||||
defer func() { require.NoError(b, db.Close(context.Background())) }()
|
|
||||||
|
|
||||||
obj := testutil.GenerateObject()
|
obj := testutil.GenerateObject()
|
||||||
for i := range 100_000 { // should be a multiple of all batch sizes
|
for i := range 100_000 { // should be a multiple of all batch sizes
|
||||||
|
@ -55,7 +56,7 @@ func benchmarkListWithCursor(b *testing.B, db *meta.DB, batchSize int) {
|
||||||
for range b.N {
|
for range b.N {
|
||||||
res, err := db.ListWithCursor(context.Background(), prm)
|
res, err := db.ListWithCursor(context.Background(), prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != meta.ErrEndOfListing {
|
if errors.Is(err, meta.ErrEndOfListing) {
|
||||||
b.Fatalf("error: %v", err)
|
b.Fatalf("error: %v", err)
|
||||||
}
|
}
|
||||||
prm.SetCursor(nil)
|
prm.SetCursor(nil)
|
||||||
|
|
Loading…
Reference in a new issue