Skip to content

Commit

Permalink
[CI] Log test retry information on workflow page (#3103)
Browse files Browse the repository at this point in the history
* test/helper.rb - log retries in Actions workflow summary

* test/helpers/integration.rb - io/wait is loaded by helper.rb
  • Loading branch information
MSP-Greg committed Mar 27, 2023
1 parent e26b13e commit 68f62d5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
26 changes: 26 additions & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,35 @@ def run
end

Minitest::Test.prepend TimeoutEveryTestCase

if ENV['CI']
require 'minitest/retry'

SUMMARY_FILE = ENV['GITHUB_STEP_SUMMARY']

Minitest::Retry.use!

if SUMMARY_FILE && ENV['GITHUB_ACTIONS'] == 'true'

GITHUB_STEP_SUMMARY_MUTEX = Mutex.new

Minitest::Retry.on_failure do |klass, test_name, result|
full_method = "#{klass}##{test_name}"
result_str = result.to_s.gsub(/#{full_method}:?\s*/, '').dup
result_str.gsub!(/\A(Failure:|Error:)\s/, '\1 ')
issue = result_str[/\A[^\n]+/]
result_str.gsub!(issue, '')
# shorten directory lists
result_str.gsub! ENV['GITHUB_WORKSPACE'], 'puma'
result_str.gsub! ENV['RUNNER_TOOL_CACHE'], ''
# remove indent
result_str.gsub!(/^ +/, '')
str = "\n**#{full_method}**\n**#{issue}**\n```\n#{result_str.strip}\n```\n"
GITHUB_STEP_SUMMARY_MUTEX.synchronize {
File.write SUMMARY_FILE, str, mode: 'a+'
}
end
end
end

module TestSkips
Expand Down
1 change: 0 additions & 1 deletion test/helpers/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require "puma/control_cli"
require "json"
require "open3"
require "io/wait"
require_relative 'tmp_path'

# Only single mode tests go here. Cluster and pumactl tests
Expand Down

0 comments on commit 68f62d5

Please sign in to comment.