diff --git a/storage/metric/operation.go b/storage/metric/operation.go index eacbe80d5..ac526eeca 100644 --- a/storage/metric/operation.go +++ b/storage/metric/operation.go @@ -175,7 +175,7 @@ func (g *getValuesAlongRangeOp) ExtractSamples(in []model.SamplePair) (out []mod return } - lastSampleTime := in[lastIdx - 1].Timestamp + lastSampleTime := in[lastIdx-1].Timestamp g.from = lastSampleTime.Add(time.Duration(1)) return in[firstIdx:lastIdx] } diff --git a/storage/metric/operation_test.go b/storage/metric/operation_test.go index 63c199772..a648689c9 100644 --- a/storage/metric/operation_test.go +++ b/storage/metric/operation_test.go @@ -1487,15 +1487,15 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // No values. { op: getValuesAlongRangeOp{ - from: testInstant, - through: testInstant.Add(1 * time.Minute), + from: testInstant, + through: testInstant.Add(1 * time.Minute), }, }, // Entire operator range before first value. { op: getValuesAlongRangeOp{ - from: testInstant, - through: testInstant.Add(1 * time.Minute), + from: testInstant, + through: testInstant.Add(1 * time.Minute), }, in: []model.SamplePair{ { @@ -1512,8 +1512,8 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // Operator range starts before first value, ends within available values. { op: getValuesAlongRangeOp{ - from: testInstant, - through: testInstant.Add(2 * time.Minute), + from: testInstant, + through: testInstant.Add(2 * time.Minute), }, in: []model.SamplePair{ { @@ -1535,8 +1535,8 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // Entire operator range is within available values. { op: getValuesAlongRangeOp{ - from: testInstant.Add(1 * time.Minute), - through: testInstant.Add(2 * time.Minute), + from: testInstant.Add(1 * time.Minute), + through: testInstant.Add(2 * time.Minute), }, in: []model.SamplePair{ { @@ -1562,8 +1562,8 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // Operator range begins before first value, ends after last. { op: getValuesAlongRangeOp{ - from: testInstant, - through: testInstant.Add(3 * time.Minute), + from: testInstant, + through: testInstant.Add(3 * time.Minute), }, in: []model.SamplePair{ { @@ -1589,8 +1589,8 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // Operator range begins within available values, ends after the last value. { op: getValuesAlongRangeOp{ - from: testInstant.Add(2 * time.Minute), - through: testInstant.Add(4 * time.Minute), + from: testInstant.Add(2 * time.Minute), + through: testInstant.Add(4 * time.Minute), }, in: []model.SamplePair{ { @@ -1624,8 +1624,8 @@ func TestGetValuesAlongRangeOp(t *testing.T) { // Entire operator range after the last available value. { op: getValuesAlongRangeOp{ - from: testInstant.Add(2 * time.Minute), - through: testInstant.Add(3 * time.Minute), + from: testInstant.Add(2 * time.Minute), + through: testInstant.Add(3 * time.Minute), }, in: []model.SamplePair{ {