0.3.0 unit tests: influxdb
This commit is contained in:
parent
936c5a8a7a
commit
b9869eadc3
|
@ -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",
|
// JSON will truncate floats to integer representations.
|
||||||
map[string]interface{}{
|
// Since there's no distinction in JSON, we can't assume it's an int.
|
||||||
// JSON will truncate floats to integer representations.
|
"i": -1.0,
|
||||||
// Since there's no distinction in JSON, we can't assume it's an int.
|
"f": 0.5,
|
||||||
"i": -1.0,
|
"b": true,
|
||||||
"f": 0.5,
|
"s": "string",
|
||||||
"b": true,
|
}
|
||||||
"s": "string",
|
tags := map[string]string{
|
||||||
},
|
"id": "ex1",
|
||||||
map[string]string{
|
"url": fakeServer.URL + "/endpoint",
|
||||||
"id": "ex1",
|
}
|
||||||
"url": fakeServer.URL + "/endpoint",
|
acc.AssertContainsTaggedFields(t, "foo", fields, tags)
|
||||||
},
|
|
||||||
))
|
fields = map[string]interface{}{
|
||||||
require.NoError(t, acc.ValidateTaggedFieldsValue(
|
"x": "x",
|
||||||
"bar",
|
}
|
||||||
map[string]interface{}{
|
tags = map[string]string{
|
||||||
"x": "x",
|
"id": "ex2",
|
||||||
},
|
"url": fakeServer.URL + "/endpoint",
|
||||||
map[string]string{
|
}
|
||||||
"id": "ex2",
|
acc.AssertContainsTaggedFields(t, "bar", fields, tags)
|
||||||
"url": fakeServer.URL + "/endpoint",
|
|
||||||
},
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue