Module: RSMP::Validator::Helpers::Connection
- Defined in:
- lib/rsmp/validator/helpers/connection.rb
Overview
Helpers for connecting to a site or supervisor in tests, with optional version-based skipping via sxl: and core: keyword arguments.
with_site(:connected, sxl: ‘>=1.2’) do |supervisor, site_proxy|
...
end
with_supervisor(:connected, core: ‘>=3.2’) do |site, supervisor_proxy|
...
end
Defined Under Namespace
Classes: UncaughtException
Constant Summary collapse
- VALID_STATES =
%i[connected reconnected isolated disconnected].freeze
Instance Method Summary collapse
- #with_site(state, sxl: nil, core: nil, **opts, &block) ⇒ Object
- #with_supervisor(state, sxl: nil, core: nil, **opts, &block) ⇒ Object
Instance Method Details
#with_site(state, sxl: nil, core: nil, **opts, &block) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rsmp/validator/helpers/connection.rb', line 26 def with_site(state, sxl: nil, core: nil, **opts, &block) validate_state!(state) check_version_requirements(sxl, core) if state == :disconnected RSMP::Validator::SiteTester.disconnected { block.call } else RSMP::Validator::SiteTester.public_send(state, **opts) do |_task, _node, proxy| block.call(proxy) rescue RSMP::TimeoutError => e @__assertions__.assert false, e. rescue StandardError => e @__assertions__.error!(UncaughtException.new(e)) end end end |
#with_supervisor(state, sxl: nil, core: nil, **opts, &block) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rsmp/validator/helpers/connection.rb', line 42 def with_supervisor(state, sxl: nil, core: nil, **opts, &block) validate_state!(state) check_version_requirements(sxl, core) if state == :disconnected RSMP::Validator::SupervisorTester.disconnected { block.call } else RSMP::Validator::SupervisorTester.public_send(state, **opts) do |_task, _node, proxy| block.call(proxy) rescue RSMP::TimeoutError => e @__assertions__.assert false, e. rescue StandardError => e @__assertions__.error!(UncaughtException.new(e)) end end end |