diff --git a/internal/p2p/metrics_test.go b/internal/p2p/metrics_test.go new file mode 100644 index 000000000..e1add2979 --- /dev/null +++ b/internal/p2p/metrics_test.go @@ -0,0 +1,19 @@ +package p2p + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/proto/tendermint/statesync" +) + +func TestValueToMetricsLabel(t *testing.T) { + m := NopMetrics() + r := &statesync.ParamsRequest{} + str := m.ValueToMetricLabel(r) + assert.Equal(t, "statesync_ParamsRequest", str) + + // subsequent calls to the function should produce the same result + str = m.ValueToMetricLabel(r) + assert.Equal(t, "statesync_ParamsRequest", str) +}