|
|
@@ -90,6 +90,19 @@ func TestClient(t *testing.T) {
|
|
|
So(err, ShouldBeNil)
|
|
|
So(c.GetVersion(), ShouldEqual, 56)
|
|
|
})
|
|
|
+
|
|
|
+ Convey("When version 60 should return v6.0 client", func() {
|
|
|
+ ds := &models.DataSource{
|
|
|
+ JsonData: simplejson.NewFromAny(map[string]interface{}{
|
|
|
+ "esVersion": 60,
|
|
|
+ "timeField": "@timestamp",
|
|
|
+ }),
|
|
|
+ }
|
|
|
+
|
|
|
+ c, err := NewClient(context.Background(), ds, nil)
|
|
|
+ So(err, ShouldBeNil)
|
|
|
+ So(c.GetVersion(), ShouldEqual, 60)
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
Convey("Given a fake http client", func() {
|
|
|
@@ -153,8 +166,6 @@ func TestClient(t *testing.T) {
|
|
|
jBody, err := simplejson.NewJson(bodyBytes)
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
|
- fmt.Println("body", string(headerBytes))
|
|
|
-
|
|
|
So(jHeader.Get("index").MustString(), ShouldEqual, "metrics-2018.05.15")
|
|
|
So(jHeader.Get("ignore_unavailable").MustBool(false), ShouldEqual, true)
|
|
|
So(jHeader.Get("search_type").MustString(), ShouldEqual, "count")
|
|
|
@@ -209,8 +220,6 @@ func TestClient(t *testing.T) {
|
|
|
jBody, err := simplejson.NewJson(bodyBytes)
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
|
- fmt.Println("body", string(headerBytes))
|
|
|
-
|
|
|
So(jHeader.Get("index").MustString(), ShouldEqual, "metrics-2018.05.15")
|
|
|
So(jHeader.Get("ignore_unavailable").MustBool(false), ShouldEqual, true)
|
|
|
So(jHeader.Get("search_type").MustString(), ShouldEqual, "query_then_fetch")
|
|
|
@@ -265,8 +274,6 @@ func TestClient(t *testing.T) {
|
|
|
jBody, err := simplejson.NewJson(bodyBytes)
|
|
|
So(err, ShouldBeNil)
|
|
|
|
|
|
- fmt.Println("body", string(headerBytes))
|
|
|
-
|
|
|
So(jHeader.Get("index").MustString(), ShouldEqual, "metrics-2018.05.15")
|
|
|
So(jHeader.Get("ignore_unavailable").MustBool(false), ShouldEqual, true)
|
|
|
So(jHeader.Get("search_type").MustString(), ShouldEqual, "query_then_fetch")
|