Skip to content

Commit 11e2833

Browse files
committed
only screenshot in verbose mode
1 parent d65e2c8 commit 11e2833

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

cli/exp_scaletest.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,11 @@ func (r *RootCmd) scaletestDashboard() *clibase.Cmd {
11581158
Headless: headless,
11591159
RandIntn: rndGen.Intn,
11601160
}
1161+
// Only take a screenshot if we're in verbose mode.
1162+
// This could be useful for debugging, but it will blow up the disk.
1163+
if r.verbose {
1164+
config.Screenshot = dashboard.Screenshot
1165+
}
11611166
//nolint:gocritic
11621167
logger.Info(ctx, "runner config", slog.F("interval", interval), slog.F("jitter", jitter), slog.F("headless", headless), slog.F("trace", tracingEnabled))
11631168
if err := config.Validate(); err != nil {

scaletest/dashboard/chromedp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func visitMainPage(ctx context.Context, u *url.URL) error {
230230
return chromedp.Run(ctx, chromedp.Navigate(u.String()))
231231
}
232232

233-
func screenshot(ctx context.Context, name string) (string, error) {
233+
func Screenshot(ctx context.Context, name string) (string, error) {
234234
var buf []byte
235235
if err := chromedp.Run(ctx, chromedp.CaptureScreenshot(&buf)); err != nil {
236236
return "", xerrors.Errorf("capture screenshot: %w", err)

scaletest/dashboard/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewRunner(client *codersdk.Client, metrics Metrics, cfg Config) *Runner {
3333
cfg.ActionFunc = clickRandomElement
3434
}
3535
if cfg.Screenshot == nil {
36-
cfg.Screenshot = screenshot
36+
cfg.Screenshot = Screenshot
3737
}
3838
return &Runner{
3939
client: client,

0 commit comments

Comments
 (0)