Skip to content

Commit

Permalink
indexer: remove failing BenchmarkFetchTx
Browse files Browse the repository at this point in the history
it's failing with:
--- FAIL: BenchmarkFetchTx
    bench_test.go:157:
        error:
          got non-nil error
        got:
          e"transaction not found"
        stack:
          /home/runner/work/vocdoni-node/vocdoni-node/vochain/indexer/bench_test.go:157
            qt.Assert(b, err, qt.IsNil)
  • Loading branch information
altergui committed Jul 13, 2023
1 parent 83f2f52 commit c17ff68
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions vochain/indexer/bench_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package indexer

import (
"fmt"
"math/big"
"sync"
"testing"
Expand Down Expand Up @@ -127,40 +126,6 @@ func BenchmarkIndexer(b *testing.B) {
}
}

func BenchmarkFetchTx(b *testing.B) {
numTxs := 1000
app := vochain.TestBaseApplication(b)

idx := newTestIndexer(b, app, true)

b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
for j := 0; j < numTxs; j++ {
idx.OnNewTx(&vochaintx.Tx{TxID: util.Random32()}, uint32(i), int32(j))
}
err := idx.Commit(uint32(i))
qt.Assert(b, err, qt.IsNil)

time.Sleep(time.Second * 2)

startTime := time.Now()
for j := 0; j < numTxs; j++ {
_, err = idx.GetTransaction(uint64((i * numTxs) + j + 1))
qt.Assert(b, err, qt.IsNil)
}
log.Infof("fetched %d transactions (out of %d total) by index, took %s",
numTxs, (i+1)*numTxs, time.Since(startTime))
startTime = time.Now()
for j := 0; j < numTxs; j++ {
_, err = idx.GetTxHashReference([]byte(fmt.Sprintf("hash%d%d", i, j)))
qt.Assert(b, err, qt.IsNil)
}
log.Infof("fetched %d transactions (out of %d total) by hash, took %s",
numTxs, (i+1)*numTxs, time.Since(startTime))
}
}

func BenchmarkNewProcess(b *testing.B) {
app := vochain.TestBaseApplication(b)

Expand Down

0 comments on commit c17ff68

Please sign in to comment.