Skip to content

Commit

Permalink
tests: only enable metrics and revert to disable if already disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Jan 13, 2025
1 parent 469767e commit 2164d72
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions warp/handlers/signature_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ import (
)

func TestMessageSignatureHandler(t *testing.T) {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
metricsEnabled := metrics.Enabled
if !metricsEnabled {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
}

database := memdb.New()
snowCtx := utils.TestSnowContext()
Expand Down Expand Up @@ -131,10 +134,13 @@ func TestMessageSignatureHandler(t *testing.T) {
}

func TestBlockSignatureHandler(t *testing.T) {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
metricsEnabled := metrics.Enabled
if !metricsEnabled {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
}

database := memdb.New()
snowCtx := utils.TestSnowContext()
Expand Down
22 changes: 14 additions & 8 deletions warp/verifier_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ import (
)

func TestAddressedCallSignatures(t *testing.T) {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
metricsEnabled := metrics.Enabled
if !metricsEnabled {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
}

database := memdb.New()
snowCtx := utils.TestSnowContext()
Expand Down Expand Up @@ -144,10 +147,13 @@ func TestAddressedCallSignatures(t *testing.T) {
}

func TestBlockSignatures(t *testing.T) {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
metricsEnabled := metrics.Enabled
if !metricsEnabled {
metrics.Enabled = true
t.Cleanup(func() {
metrics.Enabled = false
})
}

database := memdb.New()
snowCtx := utils.TestSnowContext()
Expand Down

0 comments on commit 2164d72

Please sign in to comment.