Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit 6fa1224

Browse files
Vvaradinovfedekunze
authored andcommitted
tests(evm): add benchmark tests setup for params (#1623)
* tests: add benchmark tests setup * fix: localized benchmark tests to keeper * update benchmark Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> (cherry picked from commit 9305788)
1 parent 64e80be commit 6fa1224

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

x/evm/keeper/keeper_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"math"
77
"math/big"
8+
"os"
89
"testing"
910
"time"
1011

@@ -77,6 +78,9 @@ type KeeperTestSuite struct {
7778
var s *KeeperTestSuite
7879

7980
func TestKeeperTestSuite(t *testing.T) {
81+
if os.Getenv("benchmark") != "" {
82+
t.Skip("Skipping Gingko Test")
83+
}
8084
s = new(KeeperTestSuite)
8185
s.enableFeemarket = false
8286
s.enableLondonHF = true
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package keeper_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/evmos/ethermint/x/evm/types"
7+
)
8+
9+
func BenchmarkSetParams(b *testing.B) {
10+
suite := KeeperTestSuite{}
11+
suite.SetupTestWithT(b)
12+
params := types.DefaultParams()
13+
14+
b.ReportAllocs()
15+
b.ResetTimer()
16+
for i := 0; i < b.N; i++ {
17+
_ = suite.app.EvmKeeper.SetParams(suite.ctx, params)
18+
}
19+
}
20+
21+
func BenchmarkGetParams(b *testing.B) {
22+
suite := KeeperTestSuite{}
23+
suite.SetupTestWithT(b)
24+
25+
b.ReportAllocs()
26+
b.ResetTimer()
27+
for i := 0; i < b.N; i++ {
28+
_ = suite.app.EvmKeeper.GetParams(suite.ctx)
29+
}
30+
}

0 commit comments

Comments
 (0)