@@ -2,9 +2,6 @@ package querier
2
2
3
3
import (
4
4
"context"
5
- "fmt"
6
- "sort"
7
- "testing"
8
5
"time"
9
6
10
7
"github.com/prometheus/common/model"
@@ -52,36 +49,3 @@ func mkChunk(t require.TestingT, mint, maxt model.Time, step time.Duration, enco
52
49
}
53
50
return chunk .NewChunk (metric , pc , mint , maxt )
54
51
}
55
-
56
- func TestPartitionChunksOutputIsSortedByLabels (t * testing.T ) {
57
- t .Parallel ()
58
-
59
- var allChunks []chunk.Chunk
60
-
61
- const count = 10
62
- // go down, to add series in reversed order
63
- for i := count ; i > 0 ; i -- {
64
- ch := mkChunk (t , model .Time (0 ), model .Time (1000 ), time .Millisecond , promchunk .PrometheusXorChunk )
65
- // mkChunk uses `foo` as metric name, so we rename metric to be unique
66
- ch .Metric [0 ].Value = fmt .Sprintf ("%02d" , i )
67
-
68
- allChunks = append (allChunks , ch )
69
- }
70
-
71
- res := partitionChunks (allChunks , 0 , 1000 , mergeChunks )
72
-
73
- // collect labels from each series
74
- var seriesLabels []labels.Labels
75
- for res .Next () {
76
- seriesLabels = append (seriesLabels , res .At ().Labels ())
77
- }
78
-
79
- require .Len (t , seriesLabels , count )
80
- require .True (t , sort .IsSorted (sortedByLabels (seriesLabels )))
81
- }
82
-
83
- type sortedByLabels []labels.Labels
84
-
85
- func (b sortedByLabels ) Len () int { return len (b ) }
86
- func (b sortedByLabels ) Swap (i , j int ) { b [i ], b [j ] = b [j ], b [i ] }
87
- func (b sortedByLabels ) Less (i , j int ) bool { return labels .Compare (b [i ], b [j ]) < 0 }
0 commit comments