stackdriver: pattern formatting for annotations

This commit is contained in:
Daniel Lee
2018-09-27 16:18:48 +02:00
parent 9351b56e57
commit a63877bd4f
2 changed files with 42 additions and 21 deletions
@@ -19,14 +19,14 @@ func TestStackdriverAnnotationQuery(t *testing.T) {
res := &tsdb.QueryResult{Meta: simplejson.New(), RefId: "annotationQuery"}
query := &StackdriverQuery{}
err = executor.parseToAnnotations(res, data, query, "atitle", "atext", "atag")
err = executor.parseToAnnotations(res, data, query, "atitle {{metric.label.instance_name}} {{value}}", "atext {{resource.label.zone}}", "atag")
So(err, ShouldBeNil)
Convey("Should return annotations table", func() {
So(len(res.Tables), ShouldEqual, 1)
So(len(res.Tables[0].Rows), ShouldEqual, 9)
So(res.Tables[0].Rows[0][1], ShouldEqual, "atitle")
So(res.Tables[0].Rows[0][3], ShouldEqual, "atext")
So(res.Tables[0].Rows[0][1], ShouldEqual, "atitle collector-asia-east-1 9.856650")
So(res.Tables[0].Rows[0][3], ShouldEqual, "atext asia-east1-a")
})
})
})