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"
|
- "app/services/tournament_sync_pusher.rb"
|
||||||
- "db/migrate/**/*"
|
- "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:
|
Rails/Delegate:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "app/controllers/tournaments_controller.rb"
|
- "app/controllers/tournaments_controller.rb"
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ require 'optparse'
|
||||||
|
|
||||||
require_relative 'lib/load_test_runner'
|
require_relative 'lib/load_test_runner'
|
||||||
|
|
||||||
def write_line(message = '')
|
|
||||||
$stdout.write("#{message}\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
def parse_client_list(value)
|
def parse_client_list(value)
|
||||||
return [] if value.nil? || value.strip == '' || value.strip.casecmp('none').zero?
|
return [] if value.nil? || value.strip == '' || value.strip.casecmp('none').zero?
|
||||||
|
|
||||||
|
|
@ -76,12 +72,12 @@ runner = TurniereE2E::LoadTestRunner.new(**runner_options)
|
||||||
result = runner.run
|
result = runner.run
|
||||||
|
|
||||||
if options[:format] == 'json'
|
if options[:format] == 'json'
|
||||||
write_line JSON.pretty_generate(result)
|
puts JSON.pretty_generate(result)
|
||||||
else
|
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|
|
result.fetch(:http).each do |level|
|
||||||
write_line(
|
puts(
|
||||||
"HTTP #{level.fetch(:clients)} clients: " \
|
"HTTP #{level.fetch(:clients)} clients: " \
|
||||||
"#{level.fetch(:ok)}/#{level.fetch(:requests)} ok, errors=#{level.fetch(:errors)}, " \
|
"#{level.fetch(:ok)}/#{level.fetch(:requests)} ok, errors=#{level.fetch(:errors)}, " \
|
||||||
"p50=#{level.fetch(:p50_ms)}ms, p95=#{level.fetch(:p95_ms)}ms, " \
|
"p50=#{level.fetch(:p50_ms)}ms, p95=#{level.fetch(:p95_ms)}ms, " \
|
||||||
|
|
@ -90,7 +86,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
result.fetch(:websocket).each do |level|
|
result.fetch(:websocket).each do |level|
|
||||||
write_line(
|
puts(
|
||||||
"WS #{level.fetch(:clients)} clients: " \
|
"WS #{level.fetch(:clients)} clients: " \
|
||||||
"opened=#{level.fetch(:opened)}, errors=#{level.fetch(:errors)}, " \
|
"opened=#{level.fetch(:opened)}, errors=#{level.fetch(:errors)}, " \
|
||||||
"p50_open=#{level.fetch(:p50_open_ms)}ms, p95_open=#{level.fetch(:p95_open_ms)}ms, " \
|
"p50_open=#{level.fetch(:p50_open_ms)}ms, p95_open=#{level.fetch(:p95_open_ms)}ms, " \
|
||||||
|
|
@ -99,7 +95,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
metrics = result.fetch(:metrics)
|
metrics = result.fetch(:metrics)
|
||||||
write_line(
|
puts(
|
||||||
"Metrics: action_cable_connections=#{metrics.fetch(:action_cable_connections)}, " \
|
"Metrics: action_cable_connections=#{metrics.fetch(:action_cable_connections)}, " \
|
||||||
"action_cable_connections_total=#{metrics.fetch(:action_cable_connections_total)}, " \
|
"action_cable_connections_total=#{metrics.fetch(:action_cable_connections_total)}, " \
|
||||||
"ruby_threads=#{metrics.fetch(:ruby_threads)}"
|
"ruby_threads=#{metrics.fetch(:ruby_threads)}"
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,8 @@ require 'json'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require_relative '../e2e/lib/scenario_runner'
|
require_relative '../e2e/lib/scenario_runner'
|
||||||
|
|
||||||
def write_line(message)
|
|
||||||
$stdout.write("#{message}\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
def fail_with(message)
|
def fail_with(message)
|
||||||
$stderr.write("#{message}\n")
|
warn message
|
||||||
raise SystemExit, 1
|
raise SystemExit, 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -78,4 +74,4 @@ result = case scenario
|
||||||
fail_with("Unknown scenario #{scenario.inspect}")
|
fail_with("Unknown scenario #{scenario.inspect}")
|
||||||
end
|
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 = TurniereE2E::ScenarioRunner.new(base_url: url)
|
||||||
runner.wait_for_healthcheck!(timeout_seconds: timeout)
|
runner.wait_for_healthcheck!(timeout_seconds: timeout)
|
||||||
$stdout.write("ready: #{url}\n")
|
puts "ready: #{url}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue