From 1b2a747cff4f96efdbe776559b2a72e52ec8597c Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 22 Jun 2022 21:30:12 +0800 Subject: [PATCH] fix: check if no valid testcase found --- hrp/internal/boomer/runner.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hrp/internal/boomer/runner.go b/hrp/internal/boomer/runner.go index 68109901..8419f6ab 100644 --- a/hrp/internal/boomer/runner.go +++ b/hrp/internal/boomer/runner.go @@ -256,7 +256,10 @@ func (r *runner) setTasks(t []*Task) { func (r *runner) getTask() *Task { tasksCount := len(r.tasks) - if tasksCount == 1 { + if tasksCount == 0 { + log.Error().Msg("no valid testcase found") + os.Exit(1) + } else if tasksCount == 1 { // Fast path return r.tasks[0] } @@ -326,7 +329,7 @@ func (r *localRunner) start() { // start running go func() { - var ticker = time.NewTicker(reportStatsInterval) + ticker := time.NewTicker(reportStatsInterval) for { select { // record stats