def test_update_health_monitor_in_db( self, mock_health_mon_repo_update, mock_generate_uuid, mock_LOG, mock_get_session, mock_loadbalancer_repo_update, mock_listener_repo_update, mock_amphora_repo_update, mock_amphora_repo_delete): update_health_mon = database_tasks.UpdateHealthMonInDB() update_health_mon.execute(self.health_mon_mock, { 'delay': 1, 'timeout': 2 }) repo.HealthMonitorRepository.update.assert_called_once_with('TEST', POOL_ID, delay=1, timeout=2) # Test the revert mock_health_mon_repo_update.reset_mock() update_health_mon.revert(self.health_mon_mock) # TODO(johnsom) fix this to set the upper ojects to ERROR repo.HealthMonitorRepository.update.assert_called_once_with('TEST', POOL_ID, enabled=0)
def get_update_health_monitor_flow(self): """Create a flow to update a health monitor :returns: The flow for updating a health monitor """ update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW) update_hm_flow.add(lifecycle_tasks.HealthMonitorToErrorOnRevertTask( requires=[constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER])) update_hm_flow.add(database_tasks.MarkHealthMonitorPendingUpdateInDB( requires=constants.HEALTH_MON)) update_hm_flow.add(model_tasks. UpdateAttributes( rebind={constants.OBJECT: constants.HEALTH_MON}, requires=[constants.UPDATE_DICT])) update_hm_flow.add(amphora_driver_tasks.ListenersUpdate( requires=[constants.LOADBALANCER, constants.LISTENERS])) update_hm_flow.add(database_tasks.UpdateHealthMonInDB( requires=[constants.HEALTH_MON, constants.UPDATE_DICT])) update_hm_flow.add(database_tasks.MarkHealthMonitorActiveInDB( requires=constants.HEALTH_MON)) update_hm_flow.add(database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return update_hm_flow
def get_update_health_monitor_flow(self): """Create a flow to update a health monitor :returns: The flow for updating a health monitor """ update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW) update_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) update_hm_flow.add( database_tasks.MarkHealthMonitorPendingUpdateInDB( requires=constants.HEALTH_MON)) update_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) update_hm_flow.add( a10_database_tasks.GetFlavorData( rebind={a10constants.LB_RESOURCE: constants.LOADBALANCER}, provides=constants.FLAVOR)) update_hm_flow.add( health_monitor_tasks.UpdateHealthMonitor(requires=[ constants.LISTENERS, constants.HEALTH_MON, a10constants.VTHUNDER, constants.UPDATE_DICT, constants.FLAVOR ])) update_hm_flow.add( database_tasks.UpdateHealthMonInDB( requires=[constants.HEALTH_MON, constants.UPDATE_DICT])) update_hm_flow.add( database_tasks.MarkHealthMonitorActiveInDB( requires=constants.HEALTH_MON)) update_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) update_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) update_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_LOCAL_PARTITION, requires=(a10constants.VTHUNDER))) update_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_SHARED_PARTITION, requires=(a10constants.VTHUNDER, a10constants.WRITE_MEM_SHARED_PART))) update_hm_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=(a10constants.VTHUNDER))) return update_hm_flow
def get_update_health_monitor_flow(self): """Create a flow to update a health monitor :returns: The flow for updating a health monitor """ update_hm_flow = linear_flow.Flow(constants.UPDATE_HEALTH_MONITOR_FLOW) update_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) update_hm_flow.add( database_tasks.MarkHealthMonitorPendingUpdateInDB( requires=constants.HEALTH_MON)) update_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) update_hm_flow.add( health_monitor_tasks.UpdateHealthMonitor(requires=[ constants.LISTENERS, constants.HEALTH_MON, a10constants.VTHUNDER, constants.UPDATE_DICT ])) update_hm_flow.add( database_tasks.UpdateHealthMonInDB( requires=[constants.HEALTH_MON, constants.UPDATE_DICT])) update_hm_flow.add( database_tasks.MarkHealthMonitorActiveInDB( requires=constants.HEALTH_MON)) update_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) update_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) update_hm_flow.add( vthunder_tasks.WriteMemory(requires=a10constants.VTHUNDER)) return update_hm_flow