@@ -756,10 +756,10 @@ def method_missing(name, *args, &block)
756756 expect ( @rack_config ) . to receive ( :getInitialRuntimes ) . and_return 3
757757 expect ( @rack_config ) . to receive ( :getMaximumRuntimes ) . and_return 4
758758
759- @pooling_factory . init ( @rack_context )
760759 start = java . lang . System . currentTimeMillis
760+ @pooling_factory . init ( @rack_context )
761761 expect ( @pooling_factory . getApplication ) . not_to be nil
762- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( app_init_secs * 1000 ) # getApplication waited ~ sleep time
762+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= app_init_secs * 1000 - 70 # getApplication waited ~ sleep time
763763 end
764764
765765 it "waits acquire timeout till an application is available from the pool (than raises)" do
@@ -778,14 +778,14 @@ def method_missing(name, *args, &block)
778778 @pooling_factory . acquire_timeout = 1 . to_java # second
779779 start = java . lang . System . currentTimeMillis
780780 expect ( @pooling_factory . getApplication ) . not_to be nil
781- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( app_init_secs * 1000 )
781+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= app_init_secs * 1000 - 70
782782
783783 app2 = @pooling_factory . getApplication # now the pool is empty
784784 timeout_secs = 0.1
785785 @pooling_factory . acquire_timeout = ( timeout_secs ) . to_java
786786 start = java . lang . System . currentTimeMillis
787787 expect { @pooling_factory . getApplication } . to raise_error ( org . jruby . rack . AcquireTimeoutException )
788- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 20 ) . of ( timeout_secs * 1000 )
788+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= timeout_secs * 1000 - 20
789789
790790 @pooling_factory . finishedWithApplication ( app2 ) # gets back to the pool
791791 expect ( @pooling_factory . getApplication ) . to eq app2
@@ -818,13 +818,13 @@ def method_missing(name, *args, &block)
818818
819819 start = java . lang . System . currentTimeMillis
820820 2 . times { expect ( @pooling_factory . getApplication ) . not_to be nil }
821- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( 2 * app_get_secs * 1000 )
821+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= 2 * app_init_secs * 1000 - 70
822822
823823 start = java . lang . System . currentTimeMillis
824824 expect {
825825 @pooling_factory . getApplication
826826 } . to raise_error ( org . jruby . rack . AcquireTimeoutException )
827- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 20 ) . of ( timeout_secs * 1000 )
827+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= timeout_secs * 1000 - 20
828828 end
829829
830830 it "initializes initial runtimes in parallel (with wait set to false)" do
0 commit comments