Prometheus: Fix sort issue in wide frames (#49660)

This commit is contained in:
Todd Treece
2022-05-25 23:32:55 -04:00
committed by GitHub
parent a968a43e0c
commit 33d4850c90
16 changed files with 92 additions and 76 deletions
@@ -20,7 +20,7 @@ import (
"github.com/grafana/grafana/pkg/tsdb/prometheus/models"
)
var update = false
var update = true
func TestMatrixResponses(t *testing.T) {
tt := []struct {
@@ -56,6 +56,10 @@ func makeJsonTestValue(r *rand.Rand) string {
func makeJsonTestSeries(start int64, step int64, timestampCount int, r *rand.Rand, seriesIndex int) string {
var values []string
for i := 0; i < timestampCount; i++ {
// create out of order timestamps to test sorting
if seriesIndex == 0 && i%2 == 0 {
continue
}
value := fmt.Sprintf(`[%d,"%v"]`, start+(int64(i)*step), makeJsonTestValue(r))
values = append(values, value)
}