From 4ff33f7e7ec1fccd766fd0eccb88e301e499d1ff Mon Sep 17 00:00:00 2001 From: Marco Manino Date: Fri, 30 Aug 2024 08:50:54 +0200 Subject: [PATCH] Fix list benchmark and notify CI on error (#164) --- .github/workflows/go.yaml | 4 ++++ test/list_test.go | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 1b6992a0..b470aac2 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -102,7 +102,9 @@ jobs: - name: Run benchmarks id: bench run: | + set -o pipefail go test \ + -timeout 1h \ -tags libsqlite3 -v -p 1 ./... \ -benchmem -count $BENCH_COUNT \ -run "^$$" -bench . \ @@ -118,9 +120,11 @@ jobs: - name: Run benchmark for base code if: steps.bench-cache.outputs.cache-hit != 'true' run: | + set -o pipefail git fetch origin $BASE_BRANCH git reset --hard $BASE_SHA go test \ + -timeout 1h \ -tags libsqlite3 -v -p 1 ./... \ -benchmem -count $BENCH_COUNT \ -run "^$$" -bench . \ diff --git a/test/list_test.go b/test/list_test.go index 37074638..9e9c476d 100644 --- a/test/list_test.go +++ b/test/list_test.go @@ -180,13 +180,13 @@ func TestList(t *testing.T) { func BenchmarkList(b *testing.B) { setup := func(ctx context.Context, tx *sql.Tx, payloadSize, n int) error { - if err := insertMany(ctx, tx, "key", payloadSize, n*2); err != nil { + if err := insertMany(ctx, tx, "key", payloadSize, n); err != nil { return err } - if err := updateMany(ctx, tx, "key", payloadSize, n); err != nil { + if err := updateMany(ctx, tx, "key", payloadSize, n/2); err != nil { return err } - if err := deleteMany(ctx, tx, "key", n); err != nil { + if err := deleteMany(ctx, tx, "key", n/2); err != nil { return err } return nil