Skip to content

Commit e829cbf

Browse files
authored
fix(scaletest/dashboard): fix early exit due to validate (#10212)
1 parent ed8092c commit e829cbf

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

cli/exp_scaletest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,7 @@ func (r *RootCmd) scaletestDashboard() *clibase.Cmd {
11661166
//nolint:gocritic
11671167
logger.Info(ctx, "runner config", slog.F("interval", interval), slog.F("jitter", jitter), slog.F("headless", headless), slog.F("trace", tracingEnabled))
11681168
if err := config.Validate(); err != nil {
1169+
logger.Fatal(ctx, "validate config", slog.Error(err))
11691170
return err
11701171
}
11711172
var runner harness.Runnable = dashboard.NewRunner(userClient, metrics, config)

scaletest/dashboard/config.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,5 @@ func (c Config) Validate() error {
3939
return xerrors.Errorf("validate jitter: must be less than interval")
4040
}
4141

42-
if c.ActionFunc == nil {
43-
return xerrors.Errorf("validate action func: must not be nil")
44-
}
45-
46-
if c.RandIntn == nil {
47-
return xerrors.Errorf("validate rand intn: must not be nil")
48-
}
49-
5042
return nil
5143
}

scaletest/dashboard/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"io"
7+
"math/rand"
78
"time"
89

910
"golang.org/x/xerrors"
@@ -35,6 +36,9 @@ func NewRunner(client *codersdk.Client, metrics Metrics, cfg Config) *Runner {
3536
if cfg.Screenshot == nil {
3637
cfg.Screenshot = Screenshot
3738
}
39+
if cfg.RandIntn == nil {
40+
cfg.RandIntn = rand.Intn
41+
}
3842
return &Runner{
3943
client: client,
4044
cfg: cfg,

0 commit comments

Comments
 (0)