Prometheus/Promlib: Remove the PrometheusDataplane feature so always enabled (#92218)

This has been default behavior since v10

---------

Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
This commit is contained in:
Kyle Brandt
2024-08-26 08:53:38 -04:00
committed by GitHub
parent fa95eb8c02
commit 84e5c3af22
17 changed files with 106 additions and 138 deletions
+5 -5
View File
@@ -19,7 +19,7 @@ func TestQueryData_parseResponse(t *testing.T) {
t.Run("resultType is before result the field must parsed normally", func(t *testing.T) {
resBody := `{"data":{"resultType":"vector", "result":[{"metric":{"__name__":"some_name","environment":"some_env","id":"some_id","instance":"some_instance:1234","job":"some_job","name":"another_name","region":"some_region"},"value":[1.1,"2"]}]},"status":"success"}`
res := &http.Response{Body: io.NopCloser(bytes.NewBufferString(resBody))}
result := qd.parseResponse(context.Background(), &models.Query{}, res, false)
result := qd.parseResponse(context.Background(), &models.Query{}, res)
assert.Nil(t, result.Error)
assert.Len(t, result.Frames, 1)
})
@@ -27,7 +27,7 @@ func TestQueryData_parseResponse(t *testing.T) {
t.Run("resultType is after the result field must parsed normally", func(t *testing.T) {
resBody := `{"data":{"result":[{"metric":{"__name__":"some_name","environment":"some_env","id":"some_id","instance":"some_instance:1234","job":"some_job","name":"another_name","region":"some_region"},"value":[1.1,"2"]}],"resultType":"vector"},"status":"success"}`
res := &http.Response{Body: io.NopCloser(bytes.NewBufferString(resBody))}
result := qd.parseResponse(context.Background(), &models.Query{}, res, false)
result := qd.parseResponse(context.Background(), &models.Query{}, res)
assert.Nil(t, result.Error)
assert.Len(t, result.Frames, 1)
})
@@ -35,7 +35,7 @@ func TestQueryData_parseResponse(t *testing.T) {
t.Run("no resultType is existed in the data", func(t *testing.T) {
resBody := `{"data":{"result":[{"metric":{"__name__":"some_name","environment":"some_env","id":"some_id","instance":"some_instance:1234","job":"some_job","name":"another_name","region":"some_region"},"value":[1.1,"2"]}]},"status":"success"}`
res := &http.Response{Body: io.NopCloser(bytes.NewBufferString(resBody))}
result := qd.parseResponse(context.Background(), &models.Query{}, res, false)
result := qd.parseResponse(context.Background(), &models.Query{}, res)
assert.Error(t, result.Error)
assert.Equal(t, result.Error.Error(), "no resultType found")
})
@@ -43,7 +43,7 @@ func TestQueryData_parseResponse(t *testing.T) {
t.Run("resultType is set as empty string before result", func(t *testing.T) {
resBody := `{"data":{"resultType":"", "result":[{"metric":{"__name__":"some_name","environment":"some_env","id":"some_id","instance":"some_instance:1234","job":"some_job","name":"another_name","region":"some_region"},"value":[1.1,"2"]}]},"status":"success"}`
res := &http.Response{Body: io.NopCloser(bytes.NewBufferString(resBody))}
result := qd.parseResponse(context.Background(), &models.Query{}, res, false)
result := qd.parseResponse(context.Background(), &models.Query{}, res)
assert.Error(t, result.Error)
assert.Equal(t, result.Error.Error(), "unknown result type: ")
})
@@ -51,7 +51,7 @@ func TestQueryData_parseResponse(t *testing.T) {
t.Run("resultType is set as empty string after result", func(t *testing.T) {
resBody := `{"data":{"result":[{"metric":{"__name__":"some_name","environment":"some_env","id":"some_id","instance":"some_instance:1234","job":"some_job","name":"another_name","region":"some_region"},"value":[1.1,"2"]}],"resultType":""},"status":"success"}`
res := &http.Response{Body: io.NopCloser(bytes.NewBufferString(resBody))}
result := qd.parseResponse(context.Background(), &models.Query{}, res, false)
result := qd.parseResponse(context.Background(), &models.Query{}, res)
assert.Error(t, result.Error)
assert.Equal(t, result.Error.Error(), "unknown result type: ")
})