From 528912e9eb1510e1ec89f6b7c46c09c61bba1203 Mon Sep 17 00:00:00 2001 From: Nate Berkopec Date: Sun, 11 Sep 2022 14:33:04 +0900 Subject: [PATCH] Removes debug info from tests by default (#2948) * Removes debug info from tests by default Much quieter/less confusing test output for newbies Keeps it on in CI * PUMA_DEBUG -> PUMA_TEST_DEBUG Co-authored-by: MSP-Greg --- .github/workflows/rack2.yaml | 1 + .github/workflows/ragel.yml | 1 + .github/workflows/tests.yaml | 1 + CONTRIBUTING.md | 16 ++++++++++++++-- Rakefile | 1 + test/helper.rb | 4 ++-- test/test_puma_server_ssl.rb | 2 +- 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rack2.yaml b/.github/workflows/rack2.yaml index ba0d911c..84db4ae2 100644 --- a/.github/workflows/rack2.yaml +++ b/.github/workflows/rack2.yaml @@ -16,6 +16,7 @@ jobs: env: CI: true TESTOPTS: -v + PUMA_TEST_DEBUG: true PUMA_NO_RUBOCOP: true PUMA_CI_RACK_2: true diff --git a/.github/workflows/ragel.yml b/.github/workflows/ragel.yml index a27ab5ed..bd3c183d 100644 --- a/.github/workflows/ragel.yml +++ b/.github/workflows/ragel.yml @@ -17,6 +17,7 @@ jobs: ragel ${{ matrix.os }} ${{ matrix.ruby }} env: PUMA_NO_RUBOCOP: true + PUMA_TEST_DEBUG: true runs-on: ${{ matrix.os }} if: | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 884866da..75066ef6 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,6 +28,7 @@ jobs: needs: rubocop env: CI: true + PUMA_TEST_DEBUG: true TESTOPTS: -v PUMA_NO_RUBOCOP: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1683881..7916b1ee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -97,9 +97,15 @@ See the [Bundler docs](https://bundler.io/man/gemfile.5.html#PATH) for more deta ## Running tests -To run the entire test suite: +To run rubocop + tests: + ```sh -bundle exec rake test:all +bundle exec rake +``` + +To run the test suite only: +```sh +bundle exec rake test ``` To run a single test file: @@ -122,6 +128,12 @@ To run a single test with 5 seconds as the test case timeout: TEST_CASE_TIMEOUT=5 bundle exec m test/test_binder.rb:37 ``` +If you would like more information about extension building, SSL versions, your local Ruby version, and more, use the PUMA_TEST_DEBUG env variable: + +```sh +PUMA_TEST_DEBUG=1 bundle exec rake test +``` + #### File limits Puma's test suite opens up a lot of sockets. This may exceed the default limit of your operating system. If your file limits are low, you may experience "too many open file" errors when running the Puma test suite. diff --git a/Rakefile b/Rakefile index 86d91385..5df4980c 100644 --- a/Rakefile +++ b/Rakefile @@ -16,6 +16,7 @@ end gemspec = Gem::Specification.load("puma.gemspec") Gem::PackageTask.new(gemspec).define +Rake::FileUtilsExt.verbose_flag = !!ENV['PUMA_TEST_DEBUG'] # generate extension code using Ragel (C and Java) desc "Generate extension code (C and Java) using Ragel" task :ragel diff --git a/test/helper.rb b/test/helper.rb index da5ba4cb..6ecc6b3a 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -22,7 +22,7 @@ require_relative "helpers/apps" Thread.abort_on_exception = true $debugging_info = ''.dup -$debugging_hold = false # needed for TestCLI#test_control_clustered +$debugging_hold = false # needed for TestCLI#test_control_clustered $test_case_timeout = ENV.fetch("TEST_CASE_TIMEOUT") do RUBY_ENGINE == "ruby" ? 45 : 60 end.to_i @@ -192,7 +192,7 @@ end Minitest.after_run do # needed for TestCLI#test_control_clustered - unless $debugging_hold + if !$debugging_hold && ENV['PUMA_TEST_DEBUG'] out = $debugging_info.strip unless out.empty? dash = "\u2500" diff --git a/test/test_puma_server_ssl.rb b/test/test_puma_server_ssl.rb index 47677fec..c7f75d66 100644 --- a/test/test_puma_server_ssl.rb +++ b/test/test_puma_server_ssl.rb @@ -4,7 +4,7 @@ # loaded so HAS_SSL is defined require_relative "helper" -if ::Puma::HAS_SSL +if ::Puma::HAS_SSL && ENV['PUMA_TEST_DEBUG'] require "puma/minissl" require "net/http"