0.3.0 unit tests: influxdb

This commit is contained in:
Cameron Sparr 2016-01-07 01:11:52 -07:00
parent 936c5a8a7a
commit b9869eadc3
1 changed files with 22 additions and 25 deletions

View File

@ -72,29 +72,26 @@ func TestBasic(t *testing.T) {
require.NoError(t, plugin.Gather(&acc)) require.NoError(t, plugin.Gather(&acc))
require.Len(t, acc.Points, 2) require.Len(t, acc.Points, 2)
require.NoError(t, acc.ValidateTaggedFieldsValue( fields := map[string]interface{}{
"foo",
map[string]interface{}{
// JSON will truncate floats to integer representations. // JSON will truncate floats to integer representations.
// Since there's no distinction in JSON, we can't assume it's an int. // Since there's no distinction in JSON, we can't assume it's an int.
"i": -1.0, "i": -1.0,
"f": 0.5, "f": 0.5,
"b": true, "b": true,
"s": "string", "s": "string",
}, }
map[string]string{ tags := map[string]string{
"id": "ex1", "id": "ex1",
"url": fakeServer.URL + "/endpoint", "url": fakeServer.URL + "/endpoint",
}, }
)) acc.AssertContainsTaggedFields(t, "foo", fields, tags)
require.NoError(t, acc.ValidateTaggedFieldsValue(
"bar", fields = map[string]interface{}{
map[string]interface{}{
"x": "x", "x": "x",
}, }
map[string]string{ tags = map[string]string{
"id": "ex2", "id": "ex2",
"url": fakeServer.URL + "/endpoint", "url": fakeServer.URL + "/endpoint",
}, }
)) acc.AssertContainsTaggedFields(t, "bar", fields, tags)
} }