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 8c8514c commit 17be713
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 @@ -29,10 +29,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 @@ -148,10 +151,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 17be713

Please sign in to comment.