mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
Add failing test fo when ES server is booting up
This commit is contained in:
parent
c26d6233d1
commit
fd14a1fd5e
@ -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…
Reference in New Issue
Block a user