Skip to content

Commit c5306c8

Browse files
committed
chore: adding basic assertion
1 parent a784783 commit c5306c8

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/e2e/evm_spamoor_smoke_test.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ func TestSpamoorSmoke(t *testing.T) {
5353
WithRPCHosts(internalRPC).
5454
WithPrivateKey(TestPrivateKey)
5555

56-
ctx := context.Background()
56+
ctx := t.Context()
5757
spNode, err := spBuilder.Build(ctx)
5858
require.NoError(t, err, "failed to build sp node")
5959

60-
t.Cleanup(func() { _ = spNode.Remove(context.Background()) })
60+
t.Cleanup(func() { _ = spNode.Remove(t.Context()) })
6161
require.NoError(t, spNode.Start(ctx), "failed to start spamoor node")
6262

6363
// Wait for daemon readiness.
@@ -115,20 +115,16 @@ func TestSpamoorSmoke(t *testing.T) {
115115
time.Sleep(60 * time.Second)
116116

117117
// Fetch parsed metrics and print a concise summary.
118-
if mfs, err := api.GetMetrics(); err == nil && mfs != nil {
119-
sent := sumCounter(mfs["spamoor_transactions_sent_total"])
120-
fail := sumCounter(mfs["spamoor_transactions_failed_total"])
121-
pend := sumGauge(mfs["spamoor_pending_transactions"])
122-
gas := sumCounter(mfs["spamoor_block_gas_usage"])
123-
t.Logf("Spamoor summary: sent=%.0f failed=%.0f pending=%.0f block_gas=%.0f", sent, fail, pend, gas)
124-
} else {
125-
t.Logf("metrics unavailable or parse error: %v", err)
126-
}
118+
metrics, err := api.GetMetrics()
119+
require.NoError(t, err, "failed to get metrics")
120+
sent := sumCounter(metrics["spamoor_transactions_sent_total"])
121+
fail := sumCounter(metrics["spamoor_transactions_failed_total"])
127122

128123
time.Sleep(2 * time.Second)
129124
printCollectedTraceReport(t, collector)
130125

131-
// TODO: test should pass / fail based on results
126+
require.Greater(t, sent, float64(0), "at least one transaction should have been sent")
127+
require.Zero(t, fail, "no transactions should have failed")
132128
}
133129

134130
// --- helpers ---

0 commit comments

Comments
 (0)