stackdriver: test build filter string

(cherry picked from commit a3122a4b85)
This commit is contained in:
Erik Sundell
2018-10-10 10:39:07 +02:00
committed by bergquist
parent 93fb427310
commit 322535a2b7
+13
View File
@@ -447,6 +447,19 @@ func TestStackdriver(t *testing.T) {
})
})
Convey("when building filter string", func() {
Convey("and there are wildcards in a filter value", func() {
filterParts := []interface{}{"zone", "=", "*-central1*"}
value := buildFilterString("somemetrictype", filterParts)
So(value, ShouldEqual, `metric.type="somemetrictype" zone=has_substring("-central1")`)
})
Convey("and there are no wildcards in any filter value", func() {
filterParts := []interface{}{"zone", "=", "us-central1-a"}
value := buildFilterString("somemetrictype", filterParts)
So(value, ShouldEqual, `metric.type="somemetrictype" zone="us-central1-a"`)
})
})
})
}