def test_set_service_configuration_parameters_with_empty_service(self): # NOQA # cloudify agent does not contain any service configuration parameters. # this means all parameters should be the default ones. cloudify_agent = {} set_service_configuration_parameters(cloudify_agent) self.assertEqual( cloudify_agent['service'] [SERVICE_FAILURE_RESET_TIMEOUT_KEY], 60) self.assertEqual( cloudify_agent['service'] [SERVICE_STATUS_TRANSITION_SLEEP_INTERVAL_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_SUCCESSFUL_CONSECUTVE_STATUS_QUERIES_COUNT_KEY], 10) self.assertEqual( cloudify_agent['service'] [SERVICE_STOP_TIMEOUT_KEY], 30) self.assertEqual( cloudify_agent['service'] [SERVICE_START_TIMEOUT_KEY], 30) self.assertEqual( cloudify_agent['service'] [SERVICE_FAILURE_RESTART_DELAY_KEY], 5000)
def test_set_service_configuration_parameters_digit_validation(self): # NOQA cloudify_agent = {'service': { SERVICE_FAILURE_RESET_TIMEOUT_KEY: "Hello" }} try: set_service_configuration_parameters(cloudify_agent) self.fail('Expected NonRecoverableError since {0} is not a number' .format(SERVICE_FAILURE_RESET_TIMEOUT_KEY)) except NonRecoverableError: pass
def test_set_service_configuration_parameters_no_service(self): # NOQA from windows_agent_installer \ import set_service_configuration_parameters # cloudify agent does not contain the 'service' key. # this means all parameters should be the default ones. cloudify_agent = {} set_service_configuration_parameters(cloudify_agent) self.assertEqual( cloudify_agent['service'] [constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY], 60) self.assertEqual( cloudify_agent['service'] [constants.SERVICE_FAILURE_RESTART_DELAY_KEY], 5000)
def test_set_service_configuration_parameters_with_full_service(self): # NOQA from windows_agent_installer \ import set_service_configuration_parameters # cloudify agent does contains all service configuration parameters. # this means all parameters should be the ones we specify. cloudify_agent = {'service': { constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY: 1, constants.SERVICE_FAILURE_RESTART_DELAY_KEY: 1 }} set_service_configuration_parameters(cloudify_agent) self.assertEqual( cloudify_agent['service'] [constants.SERVICE_FAILURE_RESET_TIMEOUT_KEY], 1) self.assertEqual( cloudify_agent['service'] [constants.SERVICE_FAILURE_RESTART_DELAY_KEY], 1)
def test_set_service_configuration_parameters_with_full_service(self): # NOQA cloudify_agent = {'service': { SERVICE_FAILURE_RESET_TIMEOUT_KEY: 1, SERVICE_STATUS_TRANSITION_SLEEP_INTERVAL_KEY: 1, SERVICE_SUCCESSFUL_CONSECUTVE_STATUS_QUERIES_COUNT_KEY: 1, SERVICE_STOP_TIMEOUT_KEY: 1, SERVICE_START_TIMEOUT_KEY: 1, SERVICE_FAILURE_RESTART_DELAY_KEY: 1 }} set_service_configuration_parameters(cloudify_agent) self.assertEqual( cloudify_agent['service'] [SERVICE_FAILURE_RESET_TIMEOUT_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_STATUS_TRANSITION_SLEEP_INTERVAL_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_SUCCESSFUL_CONSECUTVE_STATUS_QUERIES_COUNT_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_STOP_TIMEOUT_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_START_TIMEOUT_KEY], 1) self.assertEqual( cloudify_agent['service'] [SERVICE_FAILURE_RESTART_DELAY_KEY], 1)