You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
607 B
Go

package metrics
// Tests for Prometheus metrics registration with a custom registry.
import (
"testing"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
)
// TestNewMetrics_WithCustomRegistry verifies metrics register on a provided registry.
func TestNewMetrics_WithCustomRegistry(t *testing.T) {
registry := prometheus.NewRegistry()
m := NewMetrics(Config{ServiceName: "svc", Enabled: true, Registry: registry})
require.NotNil(t, m)
require.NotNil(t, m.HTTPRequestsTotal)
require.NotNil(t, m.DBConnectionsActive)
require.NotNil(t, m.ScoreDistribution)
}