Skip to content

Commit

Permalink
Tweak test to work more reliably on Java 17+
Browse files Browse the repository at this point in the history
  • Loading branch information
chadlwilson committed Nov 26, 2024
1 parent 0c4f0c2 commit 836e5f0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/spec/ruby/rack/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -700,27 +700,28 @@ def createRackServletWrapper(runtime, rackup, filename); end
if app_count.addAndGet(1) == 2
raise org.jruby.rack.RackInitializationException.new('failed app init')
end
sleep(0.05)
sleep(0.01)
end
app
end
num_runtimes = 5
@rack_config.stub(:getBooleanProperty).with("jruby.runtime.init.wait").and_return false
@rack_config.should_receive(:getInitialRuntimes).and_return 3
@rack_config.should_receive(:getMaximumRuntimes).and_return 3
@rack_config.should_receive(:getInitialRuntimes).and_return num_runtimes
@rack_config.should_receive(:getMaximumRuntimes).and_return num_runtimes

@pooling_factory.init(@rack_context)
sleep(0.20)

failed = 0
3.times do
num_runtimes.times do
begin
@pooling_factory.getApplication
rescue org.jruby.rack.RackInitializationException
failed += 1
end
end
if failed != 3
fail "@pooling_factory.getApplication expected to fail once, but failed #{failed}-time(s)"
if failed != num_runtimes
fail "@pooling_factory.getApplication expected to fail #{num_runtimes} times, but failed #{failed} time(s)"
end
end

Expand Down

0 comments on commit 836e5f0

Please sign in to comment.