mirror of https://github.com/coder/coder.git
fix(scaletest/dashboard): fix early exit due to validate (#10212)
This commit is contained in:
parent
ed8092c83d
commit
e829cbf2db
|
@ -1166,6 +1166,7 @@ func (r *RootCmd) scaletestDashboard() *clibase.Cmd {
|
|||
//nolint:gocritic
|
||||
logger.Info(ctx, "runner config", slog.F("interval", interval), slog.F("jitter", jitter), slog.F("headless", headless), slog.F("trace", tracingEnabled))
|
||||
if err := config.Validate(); err != nil {
|
||||
logger.Fatal(ctx, "validate config", slog.Error(err))
|
||||
return err
|
||||
}
|
||||
var runner harness.Runnable = dashboard.NewRunner(userClient, metrics, config)
|
||||
|
|
|
@ -39,13 +39,5 @@ func (c Config) Validate() error {
|
|||
return xerrors.Errorf("validate jitter: must be less than interval")
|
||||
}
|
||||
|
||||
if c.ActionFunc == nil {
|
||||
return xerrors.Errorf("validate action func: must not be nil")
|
||||
}
|
||||
|
||||
if c.RandIntn == nil {
|
||||
return xerrors.Errorf("validate rand intn: must not be nil")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
@ -35,6 +36,9 @@ func NewRunner(client *codersdk.Client, metrics Metrics, cfg Config) *Runner {
|
|||
if cfg.Screenshot == nil {
|
||||
cfg.Screenshot = Screenshot
|
||||
}
|
||||
if cfg.RandIntn == nil {
|
||||
cfg.RandIntn = rand.Intn
|
||||
}
|
||||
return &Runner{
|
||||
client: client,
|
||||
cfg: cfg,
|
||||
|
|
Loading…
Reference in New Issue