lib/protoparser/vmimport: add more testcases for invalid timestamps and values

Updates https://github.com/VictoriaMetrics/vmctl/issues/25
This commit is contained in:
Aliaksandr Valialkin 2020-09-16 02:21:24 +03:00
parent d8183c3124
commit ffadf035fa

View file

@ -46,12 +46,14 @@ func TestRowsUnmarshalFailure(t *testing.T) {
f(`{"metric":{"foo":"bar"},"values":{"x":1},"timestamps":[3,4]}`)
f(`{"metric":{"foo":"bar"},"values":null,"timestamps":[3,4]}`)
f(`{"metric":{"foo":"bar"},"timestamps":[3,4]}`)
f(`{"metric":{"foo":"bar"},"values":["foo"],"timestamps":[3]}`)
// Invalid timestamps
f(`{"metric":{"foo":"bar"},"values":[1,2],"timestamps":3}`)
f(`{"metric":{"foo":"bar"},"values":[1,2],"timestamps":false}`)
f(`{"metric":{"foo":"bar"},"values":[1,2],"timestamps":{}}`)
f(`{"metric":{"foo":"bar"},"values":[1,2]}`)
f(`{"metric":{"foo":"bar"},"values":[1,2],"timestamps":[1,"foo"]}`)
// values and timestamps count mismatch
f(`{"metric":{"foo":"bar"},"values":[],"timestamps":[]}`)