Skip to content

Commit 5e2a6e1

Browse files
Drop support for --no-summary in favor of --summary-mode=disabled (#5729)
* Remove legacy config path migration * Drop support for --no-summary in favor of --summary-mode=disabled --------- Co-authored-by: Jan Hildebrandt <jan.hildebrandt98@gmx.de>
1 parent 7979587 commit 5e2a6e1

6 files changed

Lines changed: 4 additions & 62 deletions

File tree

internal/cmd/run.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,6 @@ func (c *cmdRun) run(cmd *cobra.Command, args []string) (err error) {
497497
}
498498

499499
func getSummaryMode(runtimeOptions lib.RuntimeOptions) (summary.Mode, bool, error) {
500-
if runtimeOptions.NoSummary.Bool {
501-
return summary.ModeDisabled, false, nil
502-
}
503-
504500
sm, err := summary.ValidateMode(runtimeOptions.SummaryMode.String)
505501
if err != nil {
506502
return summary.ModeDisabled, false, err

internal/cmd/runtime_options.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ extended: base + sets "global" as alias for "globalThis"
3131
flags.StringP("type", "t", "", "override test type, \"js\" or \"archive\"")
3232
flags.StringArrayP("env", "e", nil, "add/override environment variable with `VAR=value`")
3333
flags.Bool("no-thresholds", false, "don't run thresholds")
34-
// TODO(@joanlopez): remove by k6 v2.0, once we completely drop the support of the deprecated --no-summary flag.
35-
flags.Bool("no-summary", false, "don't show the summary at the end of the test")
36-
if err := flags.MarkDeprecated("no-summary", "use --summary-mode=disabled instead"); err != nil {
37-
panic(err) // Should never happen
38-
}
3934
flags.String("summary-mode", summary.ModeCompact.String(), "determine the summary mode,"+
4035
" \"compact\", \"full\" or \"disabled\"")
4136
flags.String(
@@ -85,7 +80,6 @@ func runtimeOptionsFromFlags(flags *pflag.FlagSet) lib.RuntimeOptions {
8580
IncludeSystemEnvVars: getNullBool(flags, "include-system-env-vars"),
8681
CompatibilityMode: getNullString(flags, "compatibility-mode"),
8782
NoThresholds: getNullBool(flags, "no-thresholds"),
88-
NoSummary: getNullBool(flags, "no-summary"),
8983
SummaryMode: getNullString(flags, "summary-mode"),
9084
SummaryExport: getNullString(flags, "summary-export"),
9185
NewMachineReadableSummary: getNullBool(flags, "new-machine-readable-summary"),
@@ -119,10 +113,6 @@ func populateRuntimeOptionsFromEnv(opts lib.RuntimeOptions, environment map[stri
119113
return opts, err
120114
}
121115

122-
if err := saveBoolFromEnv(environment, "K6_NO_SUMMARY", &opts.NoSummary); err != nil {
123-
return opts, err
124-
}
125-
126116
if envVar, ok := environment["K6_SUMMARY_MODE"]; !opts.SummaryMode.Valid && ok {
127117
opts.SummaryMode = null.StringFrom(envVar)
128118
}

internal/cmd/runtime_options_test.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,12 @@ func TestRuntimeOptions(t *testing.T) {
383383
},
384384
"summary and thresholds from env": {
385385
useSysEnv: false,
386-
systemEnv: map[string]string{"K6_NO_THRESHOLDS": "false", "K6_NO_SUMMARY": "0", "K6_SUMMARY_EXPORT": "foo"},
386+
systemEnv: map[string]string{"K6_NO_THRESHOLDS": "false", "K6_SUMMARY_EXPORT": "foo"},
387387
expRTOpts: lib.RuntimeOptions{
388388
IncludeSystemEnvVars: null.NewBool(false, false),
389389
CompatibilityMode: defaultCompatMode,
390390
Env: map[string]string{},
391391
NoThresholds: null.NewBool(false, true),
392-
NoSummary: null.NewBool(false, true),
393392
SummaryExport: null.NewString("foo", true),
394393
TracesOutput: defaultTracesOutput,
395394
SummaryMode: defaultSummaryMode,
@@ -398,14 +397,13 @@ func TestRuntimeOptions(t *testing.T) {
398397
},
399398
"summary and thresholds from env overwritten by CLI": {
400399
useSysEnv: false,
401-
systemEnv: map[string]string{"K6_NO_THRESHOLDS": "FALSE", "K6_NO_SUMMARY": "0", "K6_SUMMARY_EXPORT": "foo"},
402-
cliFlags: []string{"--no-thresholds", "true", "--no-summary", "true", "--summary-export", "bar"},
400+
systemEnv: map[string]string{"K6_NO_THRESHOLDS": "FALSE", "K6_SUMMARY_EXPORT": "foo"},
401+
cliFlags: []string{"--no-thresholds", "true", "--summary-export", "bar"},
403402
expRTOpts: lib.RuntimeOptions{
404403
IncludeSystemEnvVars: null.NewBool(false, false),
405404
CompatibilityMode: defaultCompatMode,
406405
Env: map[string]string{},
407406
NoThresholds: null.NewBool(true, true),
408-
NoSummary: null.NewBool(true, true),
409407
SummaryExport: null.NewString("bar", true),
410408
TracesOutput: defaultTracesOutput,
411409
SummaryMode: defaultSummaryMode,
@@ -418,12 +416,6 @@ func TestRuntimeOptions(t *testing.T) {
418416
cliFlags: []string{"--no-thresholds", "true"},
419417
expErr: true,
420418
},
421-
"env var error detected even when CLI flags overwrite 2": {
422-
useSysEnv: false,
423-
systemEnv: map[string]string{"K6_NO_SUMMARY": "hoo"},
424-
cliFlags: []string{"--no-summary", "true"},
425-
expErr: true,
426-
},
427419
"traces output default": {
428420
useSysEnv: false,
429421
expRTOpts: lib.RuntimeOptions{

internal/cmd/tests/cmd_run_test.go

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -154,41 +154,6 @@ func TestStdoutAndStderrAreEmptyWithQuietAndHandleSummary(t *testing.T) {
154154
func TestStdoutAndStderrAreEmptyWithQuietAndLogsForwarded(t *testing.T) {
155155
t.Parallel()
156156

157-
// TODO(@joanlopez): remove by k6 v2.0, once we completely drop the support of the deprecated --no-summary flag.
158-
t.Run("--no-summary", func(t *testing.T) {
159-
t.Parallel()
160-
161-
ts := NewGlobalTestState(t)
162-
163-
// TODO: add a test with relative path
164-
logFilePath := filepath.Join(ts.Cwd, "test.log")
165-
166-
ts.CmdArgs = []string{
167-
"k6", "--quiet", "--log-output", "file=" + logFilePath,
168-
"--log-format", "raw", "run", "--no-summary", "-",
169-
}
170-
ts.Stdin = bytes.NewBufferString(`
171-
console.log('init');
172-
export default function() { console.log('foo'); };
173-
`)
174-
cmd.ExecuteWithGlobalState(ts.GlobalState)
175-
176-
// The test state hook still catches this message
177-
assert.True(t, testutils.LogContains(ts.LoggerHook.Drain(), logrus.InfoLevel, `foo`))
178-
179-
// But it's not shown on stderr or stdout
180-
assert.Empty(t, ts.Stderr.Bytes())
181-
assert.Equal(t,
182-
"Flag --no-summary has been deprecated, use --summary-mode=disabled instead\n",
183-
ts.Stdout.String(),
184-
) // We don't expect it to be completely empty, but to contain the deprecation message for --no-summary.
185-
186-
// Instead, it should be in the log file
187-
logContents, err := fsext.ReadFile(ts.FS, logFilePath)
188-
require.NoError(t, err)
189-
assert.Equal(t, "init\ninit\nfoo\n", string(logContents)) //nolint:dupword
190-
})
191-
192157
t.Run("--summary-mode=disabled", func(t *testing.T) {
193158
t.Parallel()
194159

internal/lib/summary/summary.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Mode int
1515
const (
1616
ModeCompact = Mode(iota) // Compact mode that only displays the total results.
1717
ModeFull // Extended mode that displays total and partial results.
18-
ModeDisabled // Disabled, formerly known as --no-summary.
18+
ModeDisabled // Disabled. Can be used with --summary-mode=disabled.
1919
)
2020

2121
// ErrInvalidSummaryMode indicates the serialized summary mode is invalid.

lib/runtime_options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type RuntimeOptions struct {
4040
Env map[string]string `json:"env"`
4141

4242
NoThresholds null.Bool `json:"noThresholds"`
43-
NoSummary null.Bool `json:"noSummary"`
4443
SummaryMode null.String `json:"summaryMode"`
4544
SummaryExport null.String `json:"summaryExport"`
4645
KeyWriter null.String `json:"-"`

0 commit comments

Comments
 (0)