示例#1
0
    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)
示例#2
0
    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
示例#3
0
    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)
示例#4
0
    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)
示例#5
0
    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)