cmd/strelaypoolsrv: Prevent scraped metrics moving backwards (#5068)

This commit is contained in:
Audrius Butkevicius
2018-07-27 06:59:55 +01:00
committed by Jakob Borg
parent 5161f03f02
commit 93fdd1c012
3 changed files with 61 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
// Copyright (C) 2015 Audrius Butkevicius and Contributors (see the CONTRIBUTORS file).
package main
import (
"testing"
)
func TestMerge(t *testing.T) {
if mergeValue(1001, 1000) != 1001 {
t.Error("the computer says no")
}
if mergeValue(999, 1000) != 1000 {
t.Error("the computer says no")
}
if mergeValue(1, 1000) != 1 {
t.Error("the computer says no")
}
}