Specifications:

  • Core 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

    
    
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    # File 'spec/site/core/disconnect_spec.rb', line 16
    
    timeout = Validator.get_config('timeouts','disconnect')
          Validator::Site.isolated do |task,supervisor,site_proxy|
            supervisor.ignore_errors RSMP::DisconnectError do
              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
          rescue RSMP::TimeoutError
            raise "Site did not disconnect within #{timeout}s"
          end
  • Core 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

    
    
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    # File 'spec/site/core/disconnect_spec.rb', line 38
    
    Validator::Site.isolated do |task,supervisor,site|
            timeout = Validator.get_config('timeouts','disconnect')
    
            wait_task = task.async do
              site.wait_for_state :disconnected, timeout: timeout
              raise RSMP::DisconnectError
            rescue RSMP::TimeoutError
              # ok, no disconnect happened
            end
    
            log "Stop sending watchdogs, site should not disconnect"
            site.with_watchdog_disabled do
              wait_task.wait
            end
          end