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

This commit is contained in:
Grot (@grafanabot)
2022-05-26 05:50:53 +02:00
committed by GitHub
parent 09a93b17d9
commit 324dcae868
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)
}