(t *testing.T)
| 4314 | } |
| 4315 | |
| 4316 | func TestSortLabels(t *testing.T) { |
| 4317 | sorted := []cortexpb.LabelAdapter{ |
| 4318 | {Name: "__name__", Value: "foo"}, |
| 4319 | {Name: "bar", Value: "baz"}, |
| 4320 | {Name: "cluster", Value: "cluster"}, |
| 4321 | {Name: "sample", Value: "1"}, |
| 4322 | } |
| 4323 | |
| 4324 | // no allocations if input is already sorted |
| 4325 | require.Equal(t, 0.0, testing.AllocsPerRun(100, func() { |
| 4326 | sortLabelsIfNeeded(sorted) |
| 4327 | })) |
| 4328 | |
| 4329 | unsorted := []cortexpb.LabelAdapter{ |
| 4330 | {Name: "__name__", Value: "foo"}, |
| 4331 | {Name: "sample", Value: "1"}, |
| 4332 | {Name: "cluster", Value: "cluster"}, |
| 4333 | {Name: "bar", Value: "baz"}, |
| 4334 | } |
| 4335 | |
| 4336 | sortLabelsIfNeeded(unsorted) |
| 4337 | |
| 4338 | sort.SliceIsSorted(unsorted, func(i, j int) bool { |
| 4339 | return strings.Compare(unsorted[i].Name, unsorted[j].Name) < 0 |
| 4340 | }) |
| 4341 | } |
| 4342 | |
| 4343 | func TestDistributor_Push_Relabel(t *testing.T) { |
| 4344 | t.Parallel() |
nothing calls this directly
no test coverage detected