Skip to content

Commit

Permalink
Merge pull request #46 from bebehei/disable-terminal-output
Browse files Browse the repository at this point in the history
Expose DisableTerminalOutput setting to CLI
  • Loading branch information
rogerwelin authored Apr 26, 2023
2 parents 128bc9a + adcf007 commit 76a44cd
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions cmd/cassowary/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ func runLoadTest(c *client.Cassowary) error {
if err != nil {
return err
}
outPutResults(metrics)

if !c.DisableTerminalOutput {
outPutResults(metrics)
}

if c.ExportMetrics {
return outPutJSON(c.ExportMetricsFile, metrics)
Expand Down Expand Up @@ -193,26 +196,27 @@ func validateCLI(c *cli.Context) error {
}

cass := &client.Cassowary{
FileMode: fileMode,
BaseURL: c.String("url"),
ConcurrencyLevel: c.Int("concurrency"),
Requests: c.Int("requests"),
RequestHeader: header,
Duration: duration,
PromExport: prometheusEnabled,
TLSConfig: tlsConfig,
PromURL: c.String("prompushgwurl"),
Cloudwatch: c.Bool("cloudwatch"),
Boxplot: c.Bool("boxplot"),
Histogram: c.Bool("histogram"),
ExportMetrics: c.Bool("json-metrics"),
RawOutput: c.Bool("raw-output"),
ExportMetricsFile: c.String("json-metrics-file"),
DisableKeepAlive: c.Bool("disable-keep-alive"),
Timeout: c.Int("timeout"),
HTTPMethod: httpMethod,
URLPaths: urlSuffixes,
Data: data,
FileMode: fileMode,
DisableTerminalOutput: c.Bool("silent"),
BaseURL: c.String("url"),
ConcurrencyLevel: c.Int("concurrency"),
Requests: c.Int("requests"),
RequestHeader: header,
Duration: duration,
PromExport: prometheusEnabled,
TLSConfig: tlsConfig,
PromURL: c.String("prompushgwurl"),
Cloudwatch: c.Bool("cloudwatch"),
Boxplot: c.Bool("boxplot"),
Histogram: c.Bool("histogram"),
ExportMetrics: c.Bool("json-metrics"),
RawOutput: c.Bool("raw-output"),
ExportMetricsFile: c.String("json-metrics-file"),
DisableKeepAlive: c.Bool("disable-keep-alive"),
Timeout: c.Int("timeout"),
HTTPMethod: httpMethod,
URLPaths: urlSuffixes,
Data: data,
}

return runLoadTest(cass)
Expand Down Expand Up @@ -286,6 +290,11 @@ func runCLI(args []string) {
Aliases: []string{"raw-output"},
Usage: "enable to export raw per-request metrics",
},
&cli.BoolFlag{
Name: "s",
Aliases: []string{"silent"},
Usage: "Do not show progress and do not print results on terminal (useful for other output types)",
},
&cli.BoolFlag{
Name: "F",
Aliases: []string{"json-metrics"},
Expand Down

0 comments on commit 76a44cd

Please sign in to comment.