diff --git a/tsdb/compact_test.go b/tsdb/compact_test.go index 4db5f3b17..ef62c6966 100644 --- a/tsdb/compact_test.go +++ b/tsdb/compact_test.go @@ -593,7 +593,7 @@ func TestCompaction_CompactWithSplitting(t *testing.T) { ref := p.At() require.NoError(t, idxr.Series(ref, &lbls, nil)) - require.Equal(t, uint64(shardIndex), lbls.Labels().Hash()%shardCount) + require.Equal(t, uint64(shardIndex), labels.StableHash(lbls.Labels())%shardCount) // Collect all symbols used by series. lbls.Labels().Range(func(l labels.Label) { diff --git a/tsdb/head_test.go b/tsdb/head_test.go index 36f498b9e..4571e4db9 100644 --- a/tsdb/head_test.go +++ b/tsdb/head_test.go @@ -2495,7 +2495,7 @@ func TestHeadShardedPostings(t *testing.T) { var lbls labels.ScratchBuilder require.NoError(t, ir.Series(id, &lbls, nil)) - require.Equal(t, shardIndex, lbls.Labels().Hash()%shardCount) + require.Equal(t, shardIndex, labels.StableHash(lbls.Labels())%shardCount) } } } diff --git a/tsdb/index/index_test.go b/tsdb/index/index_test.go index 930c2ba04..64f8674f7 100644 --- a/tsdb/index/index_test.go +++ b/tsdb/index/index_test.go @@ -292,7 +292,7 @@ func TestIndexRW_Postings(t *testing.T) { var lbls labels.ScratchBuilder require.NoError(t, ir.Series(id, &lbls, nil)) - require.Equal(t, shardIndex, lbls.Labels().Hash()%shardCount) + require.Equal(t, shardIndex, labels.StableHash(lbls.Labels())%shardCount) } } })