Beispiel #1
0
def test_health_monitormgr_delete(happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    health_monitor_mgr = dv2.HealthMonitorManager(mock_driver)
    fake_health_monitor = FakeHM()
    health_monitor_mgr.delete(mock_ctx, fake_health_monitor)
    assert mock_driver.agent_rpc.delete_health_monitor.call_args == \
        mock.call(mock_ctx, fake_health_monitor.to_dict(), {}, 'test_agent')
Beispiel #2
0
def test_health_monitor_update_exception(mock_log, happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    mock_driver.agent_rpc.update_health_monitor.side_effect = Exception('test')
    health_monitor_mgr = dv2.HealthMonitorManager(mock_driver)
    fake_old_health_monitor = FakeHM(id='old_health_monitor')
    fake_new_health_monitor = FakeHM(id='new_health_monitor')
    with pytest.raises(Exception) as ex:
        health_monitor_mgr.update(mock_ctx, fake_old_health_monitor,
                                  fake_new_health_monitor)
    assert 'test' == ex.value.message
    assert mock_log.error.call_args == mock.call(
        'Exception: health monitor update: test')
Beispiel #3
0
def test_health_monitor_update(happy_path_driver):
    mock_driver, mock_ctx = happy_path_driver
    health_monitor_mgr = dv2.HealthMonitorManager(mock_driver)
    fake_old_health_monitor = FakeHM(id='old_health_monitor')
    fake_new_health_monitor = FakeHM(id='new_health_monitor')
    health_monitor_mgr.update(mock_ctx, fake_old_health_monitor,
                              fake_new_health_monitor)
    assert mock_driver.agent_rpc.update_health_monitor.call_args == \
        mock.call(
            mock_ctx,
            fake_old_health_monitor.to_dict(),
            fake_new_health_monitor.to_dict(),
            {},
            'test_agent')