mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-19 15:30:17 +00:00
Fix typos in the vmalert datasource (#814)
* Fix typos in the vmalert datasource * Fix typo in the vmalert datasource test
This commit is contained in:
parent
8e6eb2cd6b
commit
92e5d89fc9
2 changed files with 3 additions and 3 deletions
|
@ -93,7 +93,7 @@ func (s *VMStorage) Query(ctx context.Context, query string) ([]Metric, error) {
|
||||||
defer func() { _ = resp.Body.Close() }()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
body, _ := ioutil.ReadAll(resp.Body)
|
body, _ := ioutil.ReadAll(resp.Body)
|
||||||
return nil, fmt.Errorf("datasource returns unexpected response code %d for %s. Reponse body %s", resp.StatusCode, req.URL, body)
|
return nil, fmt.Errorf("datasource returns unexpected response code %d for %s. Response body %s", resp.StatusCode, req.URL, body)
|
||||||
}
|
}
|
||||||
r := &response{}
|
r := &response{}
|
||||||
if err := json.NewDecoder(resp.Body).Decode(r); err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(r); err != nil {
|
||||||
|
@ -106,7 +106,7 @@ func (s *VMStorage) Query(ctx context.Context, query string) ([]Metric, error) {
|
||||||
return nil, fmt.Errorf("unknown status: %s, Expected success or error ", r.Status)
|
return nil, fmt.Errorf("unknown status: %s, Expected success or error ", r.Status)
|
||||||
}
|
}
|
||||||
if r.Data.ResultType != rtVector {
|
if r.Data.ResultType != rtVector {
|
||||||
return nil, fmt.Errorf("unknown restul type:%s. Expected vector", r.Data.ResultType)
|
return nil, fmt.Errorf("unknown result type:%s. Expected vector", r.Data.ResultType)
|
||||||
}
|
}
|
||||||
return r.metrics()
|
return r.metrics()
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ func TestVMSelectQuery(t *testing.T) {
|
||||||
t.Fatalf("expected error status got nil")
|
t.Fatalf("expected error status got nil")
|
||||||
}
|
}
|
||||||
if _, err := am.Query(ctx, query); err == nil {
|
if _, err := am.Query(ctx, query); err == nil {
|
||||||
t.Fatalf("expected unkown status got nil")
|
t.Fatalf("expected unknown status got nil")
|
||||||
}
|
}
|
||||||
if _, err := am.Query(ctx, query); err == nil {
|
if _, err := am.Query(ctx, query); err == nil {
|
||||||
t.Fatalf("expected non-vector resultType error got nil")
|
t.Fatalf("expected non-vector resultType error got nil")
|
||||||
|
|
Loading…
Reference in a new issue