lib/protoparser/graphite: add more tests after eb45185eef

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/610
This commit is contained in:
Aliaksandr Valialkin 2020-07-08 14:10:31 +03:00
parent eb45185eef
commit d0b694c5c8

View file

@ -86,6 +86,13 @@ func TestRowsUnmarshalSuccess(t *testing.T) {
Value: 1123,
}},
})
f("aaa 1123 -1", &Rows{
Rows: []Row{{
Metric: "aaa",
Value: 1123,
Timestamp: -1,
}},
})
// Timestamp bigger than 1<<31
f("aaa 1123 429496729600", &Rows{
@ -177,13 +184,42 @@ func Test_streamContext_Read(t *testing.T) {
}
}
// -1 timestamp
currentTimestamp := int64(fasttime.UnixTimestamp())
// Full line without tags
f("aaa 1123 345", &Rows{
Rows: []Row{{
Metric: "aaa",
Value: 1123,
Timestamp: 345*1000,
}},
})
// Full line with tags
f("aaa;x=y 1123 345", &Rows{
Rows: []Row{{
Metric: "aaa",
Tags: []Tag{{
Key: "x",
Value: "y",
}},
Value: 1123,
Timestamp: 345*1000,
}},
})
// missing timestamp.
// Note that this test may be flaky due to timing issues. TODO: fix it
f("aaa 1123", &Rows{
Rows: []Row{{
Metric: "aaa",
Value: 1123,
Timestamp: currentTimestamp * 1000,
Timestamp: int64(fasttime.UnixTimestamp()) * 1000,
}},
})
// -1 timestamp. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/610
// Note that this test may be flaky due to timing issues. TODO: fix it.
f("aaa 1123 -1", &Rows{
Rows: []Row{{
Metric: "aaa",
Value: 1123,
Timestamp: int64(fasttime.UnixTimestamp()) * 1000,
}},
})
}