Skip to content

Commit 2bab161

Browse files
committed
fix: state pressure benchmark CI failure and align with other tests
Remove the 3-second sleep before requireSpammersRunning that caused all transactions to be mined before the measurement window started, leaving SteadyState at 0s. Also add deferred emitRunResult, configurable spamoor params, and spamoorStats collection to match the other benchmark tests.
1 parent c55bec1 commit 2bab161

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

test/e2e/benchmark/spamoor_state_pressure_test.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,26 @@ func (s *SpamoorSuite) TestStatePressure() {
2929
w := newResultWriter(t, "StatePressure")
3030
defer w.flush()
3131

32+
var result *benchmarkResult
33+
var wallClock time.Duration
34+
var spamoorStats *runSpamoorStats
35+
defer func() {
36+
if result != nil {
37+
emitRunResult(t, cfg, result, wallClock, spamoorStats)
38+
}
39+
}()
40+
3241
e := s.setupEnv(cfg)
3342

3443
storageSpamConfig := map[string]any{
3544
"throughput": cfg.Throughput,
3645
"total_count": cfg.CountPerSpammer,
3746
"gas_units_to_burn": cfg.GasUnitsToBurn,
38-
"max_pending": 50000,
47+
"max_pending": cfg.MaxPending,
3948
"max_wallets": cfg.MaxWallets,
40-
"base_fee": 20,
41-
"tip_fee": 2,
49+
"rebroadcast": cfg.Rebroadcast,
50+
"base_fee": cfg.BaseFee,
51+
"tip_fee": cfg.TipFee,
4252
"refill_amount": "5000000000000000000", // 5 ETH
4353
"refill_balance": "2000000000000000000", // 2 ETH
4454
"refill_interval": 600,
@@ -55,8 +65,6 @@ func (s *SpamoorSuite) TestStatePressure() {
5565
t.Cleanup(func() { _ = e.spamoorAPI.DeleteSpammer(id) })
5666
}
5767

58-
// allow spamoor time to initialise spammer goroutines before polling status
59-
time.Sleep(3 * time.Second)
6068
requireSpammersRunning(t, e.spamoorAPI, spammerIDs)
6169

6270
// wait for wallet funding to finish before recording start block
@@ -87,7 +95,7 @@ func (s *SpamoorSuite) TestStatePressure() {
8795
if err := waitForDrain(drainCtx, t.Logf, e.ethClient, 10); err != nil {
8896
t.Logf("warning: %v", err)
8997
}
90-
wallClock := time.Since(loadStart)
98+
wallClock = time.Since(loadStart)
9199

92100
endHeader, err := e.ethClient.HeaderByNumber(ctx, nil)
93101
s.Require().NoError(err, "failed to get end block header")
@@ -100,7 +108,7 @@ func (s *SpamoorSuite) TestStatePressure() {
100108

101109
traces := s.collectTraces(e, cfg.ServiceName)
102110

103-
result := newBenchmarkResult("StatePressure", bm, traces)
111+
result = newBenchmarkResult("StatePressure", bm, traces)
104112
s.Require().Greater(result.summary.SteadyState, time.Duration(0), "expected non-zero steady-state duration")
105113
result.log(t, wallClock)
106114
w.addEntries(result.entries())
@@ -109,6 +117,8 @@ func (s *SpamoorSuite) TestStatePressure() {
109117
s.Require().NoError(mErr, "failed to get final metrics")
110118
sent := sumCounter(metrics["spamoor_transactions_sent_total"])
111119
failed := sumCounter(metrics["spamoor_transactions_failed_total"])
120+
spamoorStats = &runSpamoorStats{Sent: sent, Failed: failed}
121+
112122
s.Require().Greater(sent, float64(0), "at least one transaction should have been sent")
113123
s.Require().Zero(failed, "no transactions should have failed")
114124
}

0 commit comments

Comments
 (0)