mirror of
https://github.com/luxfi/coreth.git
synced 2026-10-30 17:00:51 +00:00
24 lines
619 B
Go
24 lines
619 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package metricstest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/geth/metrics"
|
|
)
|
|
|
|
// WithMetrics enables go-ethereum metrics globally for the test.
|
|
// If metrics are already enabled, nothing is done.
|
|
// Otherwise, it enables metrics and reverts when the test finishes.
|
|
func WithMetrics(t *testing.T) {
|
|
if !metrics.Enabled() {
|
|
metrics.Enable()
|
|
t.Cleanup(func() {
|
|
// Note: There's no standard way to disable metrics once enabled
|
|
// This is a limitation of the go-ethereum metrics package
|
|
})
|
|
}
|
|
}
|