mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
add testcase for rangeForTimestamp. (#6454)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
e693af6c01
commit
3e7b463908
|
@ -2579,6 +2579,28 @@ func TestChunkWriter_ReadAfterWrite(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRangeForTimestamp(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
t int64
|
||||||
|
width int64
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
args args
|
||||||
|
expected int64
|
||||||
|
}{
|
||||||
|
{args{0, 5}, 5},
|
||||||
|
{args{1, 5}, 5},
|
||||||
|
{args{5, 5}, 10},
|
||||||
|
{args{6, 5}, 10},
|
||||||
|
{args{13, 5}, 15},
|
||||||
|
{args{95, 5}, 100},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
got := rangeForTimestamp(tt.args.t, tt.args.width)
|
||||||
|
testutil.Equals(t, tt.expected, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestChunkReader_ConcurrentReads checks that the chunk result can be read concurrently.
|
// TestChunkReader_ConcurrentReads checks that the chunk result can be read concurrently.
|
||||||
// Regression test for https://github.com/prometheus/prometheus/pull/6514.
|
// Regression test for https://github.com/prometheus/prometheus/pull/6514.
|
||||||
func TestChunkReader_ConcurrentReads(t *testing.T) {
|
func TestChunkReader_ConcurrentReads(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue