Connection
Tests
- Connection is closed if watchdogs are not acknowledged
- Connection is not closed if watchdogs are not received
Connection is closed if watchdogs are not acknowledged
- Given the site has just connected
- When our supervisor does not acknowledge watchdogs
- Then the site should disconnect
View Source
it 'is closed if watchdogs are not acknowledged' do
with_site(:isolated, sxl: '>=1.0.7') do |site_proxy|
timeout = RSMP::Validator.get_config('timeouts', 'disconnect')
log 'Disabling watchdog acknowledgements, site should disconnect'
def site_proxy.acknowledge(original)
if original.is_a? RSMP::Watchdog
log 'Not acknowledgning watchdog', message: original
else
super
end
end
site_proxy.wait_for_state!(:disconnected, timeout: timeout)
end
end
Connection is not closed if watchdogs are not received
- Given the site has just connected
- When our supervisor stops sending watchdogs
- Then the site should not disconnect
View Source
it 'is not closed if watchdogs are not received' do
with_site(:isolated, sxl: '>=1.0.7') do |site_proxy|
timeout = RSMP::Validator.get_config('timeouts', 'disconnect')
log 'Stop sending watchdogs, site should not disconnect'
site_proxy.with_watchdog_disabled do
result = site_proxy.wait_for_state :disconnected, timeout: timeout
assert(result.failure? && result.failure.code == :timeout,
"Site disconnected unexpectedly: #{result.inspect}")
end
end
end