mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
test(observability-proxy): cover the 1970 bound of metrics times
Only the upper half of the refused 1970..2262 range had a test, so the lower check could be dropped unnoticed. vmselect clamps a time before 1970 to 0, which would answer for a window other than the one asked for. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
65944fcb79
commit
89fbdb136f
1 file changed
+3
-1
@@ -109,7 +109,9 @@ func TestVmselectReadsSecondsWithFraction(t *testing.T) {
|
||||
func TestParseMetricsTimeRange(t *testing.T) {
|
||||
// vmselect reads an RFC3339 time through time.UnixNano, which is
|
||||
// undefined from 2262-04-11 on.
|
||||
for _, v := range []string{"9223372037", "9999999999", "2262-04-12T00:00:00Z", "9999-01-01T00:00:00Z"} {
|
||||
// Before 1970 vmselect clamps to 0, which would quietly answer for a
|
||||
// window other than the one asked for.
|
||||
for _, v := range []string{"9223372037", "9999999999", "2262-04-12T00:00:00Z", "9999-01-01T00:00:00Z", "1969-12-31T23:59:59Z", "1969-12-31T23:59:59.999Z"} {
|
||||
if _, herr := parseMetricsTime("time", v); herr == nil {
|
||||
t.Errorf("%q accepted, want refused", v)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user