Skip to content

Commit ac23ddb

Browse files
committed
Cap queries at now.
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
1 parent 6adb7f5 commit ac23ddb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/test/runner.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ func (r *Runner) runRandomTest() {
180180
start := r.cfg.MinTime.Time.Add(time.Duration(rand.Int63n(int64(now.Sub(r.cfg.MinTime.Time)))))
181181
duration := r.cfg.testQueryMinSize +
182182
time.Duration(rand.Int63n(int64(r.cfg.testQueryMaxSize)-int64(r.cfg.testQueryMinSize)))
183+
if start.Add(duration).After(now) {
184+
duration = now.Sub(start)
185+
}
183186

184187
var pairs []model.SamplePair
185188
err := instrument.TimeRequestHistogram(context.Background(), "Prometheus.Query", prometheusRequestDuration, func(ctx context.Context) error {

0 commit comments

Comments
 (0)