@@ -738,10 +738,10 @@ def method_missing(name, *args, &block)
738738 expect ( @rack_config ) . to receive ( :getInitialRuntimes ) . and_return 3
739739 expect ( @rack_config ) . to receive ( :getMaximumRuntimes ) . and_return 4
740740
741- @pooling_factory . init ( @rack_context )
742741 start = java . lang . System . currentTimeMillis
742+ @pooling_factory . init ( @rack_context )
743743 expect ( @pooling_factory . getApplication ) . not_to be nil
744- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( app_init_secs * 1000 ) # getApplication waited ~ sleep time
744+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= app_init_secs * 1000 - 70 # getApplication waited ~ sleep time
745745 end
746746
747747 it "waits acquire timeout till an application is available from the pool (than raises)" do
@@ -760,14 +760,14 @@ def method_missing(name, *args, &block)
760760 @pooling_factory . acquire_timeout = 1 . to_java # second
761761 start = java . lang . System . currentTimeMillis
762762 expect ( @pooling_factory . getApplication ) . not_to be nil
763- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( app_init_secs * 1000 )
763+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= app_init_secs * 1000 - 70
764764
765765 app2 = @pooling_factory . getApplication # now the pool is empty
766766 timeout_secs = 0.1
767767 @pooling_factory . acquire_timeout = ( timeout_secs ) . to_java
768768 start = java . lang . System . currentTimeMillis
769769 expect { @pooling_factory . getApplication } . to raise_error ( org . jruby . rack . AcquireTimeoutException )
770- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 20 ) . of ( timeout_secs * 1000 )
770+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= timeout_secs * 1000 - 20
771771
772772 @pooling_factory . finishedWithApplication ( app2 ) # gets back to the pool
773773 expect ( @pooling_factory . getApplication ) . to eq app2
@@ -800,13 +800,13 @@ def method_missing(name, *args, &block)
800800
801801 start = java . lang . System . currentTimeMillis
802802 2 . times { expect ( @pooling_factory . getApplication ) . not_to be nil }
803- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 70 ) . of ( 2 * app_get_secs * 1000 )
803+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= 2 * app_init_secs * 1000 - 70
804804
805805 start = java . lang . System . currentTimeMillis
806806 expect {
807807 @pooling_factory . getApplication
808808 } . to raise_error ( org . jruby . rack . AcquireTimeoutException )
809- expect ( java . lang . System . currentTimeMillis - start ) . to be_within ( 20 ) . of ( timeout_secs * 1000 )
809+ expect ( java . lang . System . currentTimeMillis - start ) . to be >= timeout_secs * 1000 - 20
810810 end
811811
812812 it "initializes initial runtimes in parallel (with wait set to false)" do
0 commit comments