Skip to content

Commit

Permalink
[CI] test_thread_pool.rb and test_config.rb fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Dec 12, 2021
1 parent 9cf89e6 commit fa178f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
26 changes: 12 additions & 14 deletions test/test_config.rb
Expand Up @@ -15,7 +15,6 @@ def test_default_max_threads
assert_equal max_threads, Puma::Configuration.new.default_max_threads
end


def test_app_from_rackup
conf = Puma::Configuration.new do |c|
c.rackup "test/rackup/hello-bind.ru"
Expand Down Expand Up @@ -59,19 +58,6 @@ def test_ssl_configuration_from_DSL
assert_equal [200, {}, ["embedded app"]], app.call({})
end

def test_custom_logger_from_DSL
conf = Puma::Configuration.new do |c|
c.load "test/config/custom_logger.rb"
end

conf.load
out, _ = capture_subprocess_io do
conf.options[:logger].write('test')
end

assert_match /Custom logging: test/, out
end

def test_ssl_bind
skip_if :jruby
skip_unless :ssl
Expand Down Expand Up @@ -423,6 +409,18 @@ def assert_run_hooks(hook_name, options = {})
end
end

# contains tests that cannot run parallel
class TestConfigFileSingle < TestConfigFileBase
def test_custom_logger_from_DSL
conf = Puma::Configuration.new { |c| c.load 'test/config/custom_logger.rb' }

conf.load
out, _ = capture_subprocess_io { conf.options[:logger].write 'test' }

assert_equal 'Custom logging: test', out
end
end

# Thread unsafe modification of ENV
class TestEnvModifificationConfig < TestConfigFileBase
def test_double_bind_port
Expand Down
4 changes: 2 additions & 2 deletions test/test_thread_pool.rb
Expand Up @@ -63,10 +63,10 @@ def test_thread_name
end

def test_thread_name_linux
skip 'Thread.name not supported' unless Thread.current.respond_to?(:name)
skip 'Thread.name not supported' unless Thread.current.respond_to?(:name) && Puma::IS_MRI

task_dir = File.join('', 'proc', Process.pid.to_s, 'task')
skip 'This test only works under Linux with appropriate permissions' if !(File.directory?(task_dir) && File.readable?(task_dir))
skip 'This test only works under Linux and MRI Ruby with appropriate permissions' if !(File.directory?(task_dir) && File.readable?(task_dir)) && Puma::IS_MRI

expected_thread_name = 'puma tst tp 001'
found_thread = false
Expand Down

0 comments on commit fa178f3

Please sign in to comment.