influxdb: escape backslashes in tag values (for alerting)

Closes #10957. Backslash escaping was already implemented on the
frontend but does not work for queries executed on the backend.
This commit is contained in:
Daniel Lee
2018-02-19 10:00:09 +01:00
parent 710bb70746
commit f959ba9bcf
2 changed files with 7 additions and 1 deletions

View File

@@ -170,6 +170,12 @@ func TestInfluxdbQueryBuilder(t *testing.T) {
So(strings.Join(query.renderTags(), ""), ShouldEqual, `"key" = 'value'`)
})
Convey("can escape backslashes when rendering string tags", func() {
query := &Query{Tags: []*Tag{{Operator: "=", Value: `C:\test\`, Key: "key"}}}
So(strings.Join(query.renderTags(), ""), ShouldEqual, `"key" = 'C:\\test\\'`)
})
Convey("can render regular measurement", func() {
query := &Query{Measurement: `apa`, Policy: "policy"}