Connection

Tests

Connection is closed if watchdogs are not acknowledged

  1. Given the site has just connected
  2. When our supervisor does not acknowledge watchdogs
  3. 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

  1. Given the site has just connected
  2. When our supervisor stops sending watchdogs
  3. 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

This site uses Just the Docs, a documentation theme for Jekyll.