mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-14 17:44:06 -08:00
Add TestStableHash
Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
parent
2a7a27f91a
commit
864e582a14
19
model/labels/sharding_test.go
Normal file
19
model/labels/sharding_test.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package labels
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestStableHash tests that StableHash is stable.
|
||||
// The hashes this test asserts should not be changed.
|
||||
func TestStableHash(t *testing.T) {
|
||||
for expectedHash, lbls := range map[uint64]Labels{
|
||||
0xef46db3751d8e999: EmptyLabels(),
|
||||
0x347c8ee7a9e29708: FromStrings("hello", "world"),
|
||||
0xcbab40540f26097d: FromStrings(MetricName, "metric", "label", "value"),
|
||||
} {
|
||||
require.Equal(t, expectedHash, StableHash(lbls))
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue