add metrics test

This commit is contained in:
William Banfield
2021-10-25 21:05:02 +02:00
parent 00b66358ba
commit b87c3b49c9
+19
View File
@@ -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)
}