Module: OpsManagerUiDrivers::WaitHelper
- Included in:
- PageHelpers
- Defined in:
- lib/ops_manager_ui_drivers/wait_helper.rb
Constant Summary collapse
- SLEEP_INTERVAL =
1- EarlyFailException =
Class.new(Exception)
Instance Method Summary collapse
- #fail_early(msg) ⇒ Object
- #poll_up_to_mins(minutes, &blk) ⇒ Object
- #wait(retries_left = 20, interval = 0.5, &blk) ⇒ Object
Instance Method Details
#fail_early(msg) ⇒ Object
26 27 28 |
# File 'lib/ops_manager_ui_drivers/wait_helper.rb', line 26 def fail_early(msg) fail(EarlyFailException.new(msg)) end |
#poll_up_to_mins(minutes, &blk) ⇒ Object
30 31 32 33 34 |
# File 'lib/ops_manager_ui_drivers/wait_helper.rb', line 30 def poll_up_to_mins(minutes, &blk) wait_debug("Polling for up to #{minutes} mins") do wait_until(minutes_to_time(minutes), &blk) end end |
#wait(retries_left = 20, interval = 0.5, &blk) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ops_manager_ui_drivers/wait_helper.rb', line 10 def wait(retries_left=20, interval=0.5, &blk) blk.call rescue EarlyFailException raise rescue RSpec::Expectations::ExpectationNotMetError, StandardError puts "------- retries_left=#{retries_left}" retries_left -= 1 if retries_left > 0 sleep(interval) retry else puts "------- propagate error=#{retries_left}" raise end end |