Add failing test fo when ES server is booting up

pull/34710/head
Elfo404 4 years ago
parent c26d6233d1
commit fd14a1fd5e
No known key found for this signature in database
GPG Key ID: 586539D9491F0726
  1. 24
      pkg/tsdb/elasticsearch/response_parser_test.go

@ -15,6 +15,30 @@ import (
func TestResponseParser(t *testing.T) {
t.Run("Elasticsearch response parser test", func(t *testing.T) {
t.Run("Boot Up", func(t *testing.T) {
// This happens when ES is booting up.
// the response is somehow incomplete, Grafana shouldn't panic in this case.
targets := map[string]string{
"A": `{
"timeField": "@timestamp",
"metrics": [{ "type": "count", "id": "1" }],
"bucketAggs": [{ "type": "date_histogram", "field": "@timestamp", "id": "2" }]
}`,
}
response := `{
"responses": [
{
"aggregations": null
}
]
}`
rp, err := newResponseParserForTest(targets, response)
require.NoError(t, err)
result, err := rp.getTimeSeries()
require.NoError(t, err)
require.Len(t, result.Results, 1)
})
t.Run("Simple query and count", func(t *testing.T) {
targets := map[string]string{
"A": `{

Loading…
Cancel
Save