fix: allow CLI script output lint
This commit is contained in:
parent
d847fa694d
commit
d8e354ec1b
|
|
@ -66,6 +66,14 @@ Rails/SkipsModelValidations:
|
|||
- "app/services/tournament_sync_pusher.rb"
|
||||
- "db/migrate/**/*"
|
||||
|
||||
# These are standalone CLI entrypoints where stdout is command output,
|
||||
# not Rails application logging.
|
||||
Rails/Output:
|
||||
Exclude:
|
||||
- "e2e/load_test.rb"
|
||||
- "script/e2e_scenarios.rb"
|
||||
- "script/wait_for_http.rb"
|
||||
|
||||
Rails/Delegate:
|
||||
Exclude:
|
||||
- "app/controllers/tournaments_controller.rb"
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ require 'optparse'
|
|||
|
||||
require_relative 'lib/load_test_runner'
|
||||
|
||||
def write_line(message = '')
|
||||
$stdout.write("#{message}\n")
|
||||
end
|
||||
|
||||
def parse_client_list(value)
|
||||
return [] if value.nil? || value.strip == '' || value.strip.casecmp('none').zero?
|
||||
|
||||
|
|
@ -76,12 +72,12 @@ runner = TurniereE2E::LoadTestRunner.new(**runner_options)
|
|||
result = runner.run
|
||||
|
||||
if options[:format] == 'json'
|
||||
write_line JSON.pretty_generate(result)
|
||||
puts JSON.pretty_generate(result)
|
||||
else
|
||||
write_line "Load test base_url=#{result.fetch(:base_url)} tournament_id=#{result.dig(:tournament, :id)}"
|
||||
puts "Load test base_url=#{result.fetch(:base_url)} tournament_id=#{result.dig(:tournament, :id)}"
|
||||
|
||||
result.fetch(:http).each do |level|
|
||||
write_line(
|
||||
puts(
|
||||
"HTTP #{level.fetch(:clients)} clients: " \
|
||||
"#{level.fetch(:ok)}/#{level.fetch(:requests)} ok, errors=#{level.fetch(:errors)}, " \
|
||||
"p50=#{level.fetch(:p50_ms)}ms, p95=#{level.fetch(:p95_ms)}ms, " \
|
||||
|
|
@ -90,7 +86,7 @@ else
|
|||
end
|
||||
|
||||
result.fetch(:websocket).each do |level|
|
||||
write_line(
|
||||
puts(
|
||||
"WS #{level.fetch(:clients)} clients: " \
|
||||
"opened=#{level.fetch(:opened)}, errors=#{level.fetch(:errors)}, " \
|
||||
"p50_open=#{level.fetch(:p50_open_ms)}ms, p95_open=#{level.fetch(:p95_open_ms)}ms, " \
|
||||
|
|
@ -99,7 +95,7 @@ else
|
|||
end
|
||||
|
||||
metrics = result.fetch(:metrics)
|
||||
write_line(
|
||||
puts(
|
||||
"Metrics: action_cable_connections=#{metrics.fetch(:action_cable_connections)}, " \
|
||||
"action_cable_connections_total=#{metrics.fetch(:action_cable_connections_total)}, " \
|
||||
"ruby_threads=#{metrics.fetch(:ruby_threads)}"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ require 'json'
|
|||
require 'optparse'
|
||||
require_relative '../e2e/lib/scenario_runner'
|
||||
|
||||
def write_line(message)
|
||||
$stdout.write("#{message}\n")
|
||||
end
|
||||
|
||||
def fail_with(message)
|
||||
$stderr.write("#{message}\n")
|
||||
warn message
|
||||
raise SystemExit, 1
|
||||
end
|
||||
|
||||
|
|
@ -78,4 +74,4 @@ result = case scenario
|
|||
fail_with("Unknown scenario #{scenario.inspect}")
|
||||
end
|
||||
|
||||
write_line JSON.pretty_generate(result)
|
||||
puts JSON.pretty_generate(result)
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ timeout = (ARGV[1] || 30).to_i
|
|||
|
||||
runner = TurniereE2E::ScenarioRunner.new(base_url: url)
|
||||
runner.wait_for_healthcheck!(timeout_seconds: timeout)
|
||||
$stdout.write("ready: #{url}\n")
|
||||
puts "ready: #{url}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue