Skip to content

Commit 0a3c199

Browse files
committed
fix integration test
Signed-off-by: Ben Ye <[email protected]>
1 parent a9982c9 commit 0a3c199

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

integration/query_frontend_test.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package integration
66
import (
77
"crypto/x509"
88
"crypto/x509/pkix"
9-
"encoding/json"
109
"fmt"
1110
"os"
1211
"path/filepath"
@@ -15,6 +14,7 @@ import (
1514
"testing"
1615
"time"
1716

17+
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
1818
"github.com/prometheus/common/model"
1919
"github.com/prometheus/prometheus/model/labels"
2020
"github.com/prometheus/prometheus/prompb"
@@ -354,16 +354,9 @@ func runQueryFrontendTest(t *testing.T, cfg queryFrontendTestConfig) {
354354
_, err := c.QueryRange("up)", start, end, time.Second)
355355
require.Error(t, err)
356356

357-
// Expect the error response format to be correct.
358-
type response struct {
359-
Status string `json:"status"`
360-
ErrorType string `json:"errorType,omitempty"`
361-
Error string `json:"error,omitempty"`
362-
}
363-
var res response
364-
err = json.Unmarshal([]byte(err.Error()), &res)
365-
require.NoError(t, err)
366-
require.Equal(t, res.ErrorType, "bad_data")
357+
apiErr, ok := err.(*v1.Error)
358+
require.True(t, ok)
359+
require.Equal(t, apiErr.Type, v1.ErrBadData)
367360
}
368361

369362
for q := 0; q < numQueriesPerUser; q++ {

0 commit comments

Comments
 (0)