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 <Greg.mpls@gmail.com>
This commit is contained in:
Nate Berkopec 2022-09-11 14:33:04 +09:00 committed by GitHub
parent 1576f9bf71
commit 528912e9eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 5 deletions

View File

@ -16,6 +16,7 @@ jobs:
env: env:
CI: true CI: true
TESTOPTS: -v TESTOPTS: -v
PUMA_TEST_DEBUG: true
PUMA_NO_RUBOCOP: true PUMA_NO_RUBOCOP: true
PUMA_CI_RACK_2: true PUMA_CI_RACK_2: true

View File

@ -17,6 +17,7 @@ jobs:
ragel ${{ matrix.os }} ${{ matrix.ruby }} ragel ${{ matrix.os }} ${{ matrix.ruby }}
env: env:
PUMA_NO_RUBOCOP: true PUMA_NO_RUBOCOP: true
PUMA_TEST_DEBUG: true
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
if: | if: |

View File

@ -28,6 +28,7 @@ jobs:
needs: rubocop needs: rubocop
env: env:
CI: true CI: true
PUMA_TEST_DEBUG: true
TESTOPTS: -v TESTOPTS: -v
PUMA_NO_RUBOCOP: true PUMA_NO_RUBOCOP: true

View File

@ -97,9 +97,15 @@ See the [Bundler docs](https://bundler.io/man/gemfile.5.html#PATH) for more deta
## Running tests ## Running tests
To run the entire test suite: To run rubocop + tests:
```sh ```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: 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 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 #### 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. 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.

View File

@ -16,6 +16,7 @@ end
gemspec = Gem::Specification.load("puma.gemspec") gemspec = Gem::Specification.load("puma.gemspec")
Gem::PackageTask.new(gemspec).define Gem::PackageTask.new(gemspec).define
Rake::FileUtilsExt.verbose_flag = !!ENV['PUMA_TEST_DEBUG']
# generate extension code using Ragel (C and Java) # generate extension code using Ragel (C and Java)
desc "Generate extension code (C and Java) using Ragel" desc "Generate extension code (C and Java) using Ragel"
task :ragel task :ragel

View File

@ -22,7 +22,7 @@ require_relative "helpers/apps"
Thread.abort_on_exception = true Thread.abort_on_exception = true
$debugging_info = ''.dup $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 $test_case_timeout = ENV.fetch("TEST_CASE_TIMEOUT") do
RUBY_ENGINE == "ruby" ? 45 : 60 RUBY_ENGINE == "ruby" ? 45 : 60
end.to_i end.to_i
@ -192,7 +192,7 @@ end
Minitest.after_run do Minitest.after_run do
# needed for TestCLI#test_control_clustered # needed for TestCLI#test_control_clustered
unless $debugging_hold if !$debugging_hold && ENV['PUMA_TEST_DEBUG']
out = $debugging_info.strip out = $debugging_info.strip
unless out.empty? unless out.empty?
dash = "\u2500" dash = "\u2500"

View File

@ -4,7 +4,7 @@
# loaded so HAS_SSL is defined # loaded so HAS_SSL is defined
require_relative "helper" require_relative "helper"
if ::Puma::HAS_SSL if ::Puma::HAS_SSL && ENV['PUMA_TEST_DEBUG']
require "puma/minissl" require "puma/minissl"
require "net/http" require "net/http"