Ejemplo n.º 1
0
Archivo: base.py Proyecto: Itxaka/st2
    def setUpClass(cls):
        super(FunctionalTest, cls).setUpClass()

        tests_config.parse_args()

        # Make sure auth is disabled
        cfg.CONF.set_default('enable', False, group='auth')

        # Make sure RBAC is disabled
        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {
                    '__force_dict__': True
                }
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Ejemplo n.º 2
0
    def _do_setUpClass(cls):
        tests_config.parse_args()

        cfg.CONF.set_default('enable', cls.enable_auth, group='auth')

        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {
                    '__force_dict__': True
                },
                'guess_content_type_from_ext': False
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Ejemplo n.º 3
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    pack_dir = cfg.CONF.register.pack
    fail_on_failure = cfg.CONF.register.fail_on_failure

    registered_count = 0

    # 1. Register runner types
    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        runners_registrar.register_runner_types(
            experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
        return

    # 2. Register actions
    try:
        registered_count = actions_registrar.register_actions(
            pack_dir=pack_dir, fail_on_failure=fail_on_failure)
    except Exception as e:
        exc_info = not fail_on_failure
        LOG.warning('Failed to register actions: %s', e, exc_info=exc_info)

        if fail_on_failure:
            raise e

    LOG.info('Registered %s actions.' % (registered_count))
Ejemplo n.º 4
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    pack_dir = cfg.CONF.register.pack
    fail_on_failure = cfg.CONF.register.fail_on_failure

    registered_count = 0

    # 1. Register runner types
    try:
        LOG.info("=========================================================")
        LOG.info("############## Registering actions ######################")
        LOG.info("=========================================================")
        runners_registrar.register_runner_types(experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning("Failed to register runner types: %s", e, exc_info=True)
        LOG.warning("Not registering stock runners .")
        return

    # 2. Register actions
    try:
        registered_count = actions_registrar.register_actions(pack_dir=pack_dir, fail_on_failure=fail_on_failure)
    except Exception as e:
        exc_info = not fail_on_failure
        LOG.warning("Failed to register actions: %s", e, exc_info=exc_info)

        if fail_on_failure:
            raise e

    LOG.info("Registered %s actions." % (registered_count))
Ejemplo n.º 5
0
Archivo: base.py Proyecto: langelee/st2
    def setUpClass(cls):
        super(FunctionalTest, cls).setUpClass()

        tests_config.parse_args()

        # Make sure auth is disabled
        cfg.CONF.set_default('enable', False, group='auth')

        # Make sure RBAC is disabled
        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True}
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Ejemplo n.º 6
0
Archivo: base.py Proyecto: Bala96/st2
    def _do_setUpClass(cls):
        tests_config.parse_args()

        cfg.CONF.set_default('enable', cls.enable_auth, group='auth')

        cfg.CONF.set_override(name='enable', override=False, group='rbac')

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True},
                'guess_content_type_from_ext': False
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = load_test_app(config=cfg_dict)
Ejemplo n.º 7
0
    def setUpClass(cls):
        super(MistralRunnerTest, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 8
0
 def setUpClass(cls):
     super(TestActionExecutionHistoryWorker, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_chain = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['chain']))
     action_chain.entry_point = fixture.PATH + '/chain.yaml'
     Action.add_or_update(ActionAPI.to_model(action_chain))
 def setUpClass(cls):
     super(TestActionExecutionHistoryWorker, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_chain = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['chain']))
     action_chain.entry_point = fixture.PATH + '/chain.yaml'
     Action.add_or_update(ActionAPI.to_model(action_chain))
Ejemplo n.º 10
0
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['runners']):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 11
0
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['runners']):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
Ejemplo n.º 12
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    registered_count = 0

    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        runners_registrar.register_runner_types(experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            registered_count = actions_registrar.register_actions(pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))
Ejemplo n.º 13
0
Archivo: base.py Proyecto: langelee/st2
    def setUpClass(cls):
        super(AuthMiddlewareTest, cls).setUpClass()
        tests_config.parse_args()

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {'__force_dict__': True}
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = TestApp(auth.AuthMiddleware(load_app(cfg_dict)))
Ejemplo n.º 14
0
def register_actions():
    # Register runnertypes and actions. The order is important because actions require action
    # types to be present in the system.
    registered_count = 0

    try:
        LOG.info('=========================================================')
        LOG.info('############## Registering actions ######################')
        LOG.info('=========================================================')
        runners_registrar.register_runner_types(
            experimental=cfg.CONF.experimental)
    except Exception as e:
        LOG.warning('Failed to register runner types: %s', e, exc_info=True)
        LOG.warning('Not registering stock runners .')
    else:
        try:
            registered_count = actions_registrar.register_actions(
                pack_dir=cfg.CONF.register.pack)
        except Exception as e:
            LOG.warning('Failed to register actions: %s', e, exc_info=True)

    LOG.info('Registered %s actions.' % (registered_count))
Ejemplo n.º 15
0
Archivo: base.py Proyecto: Itxaka/st2
    def setUpClass(cls):
        super(AuthMiddlewareTest, cls).setUpClass()
        tests_config.parse_args()

        opts = cfg.CONF.api_pecan
        cfg_dict = {
            'app': {
                'root': opts.root,
                'template_path': opts.template_path,
                'modules': opts.modules,
                'debug': opts.debug,
                'auth_enable': opts.auth_enable,
                'errors': {
                    '__force_dict__': True
                }
            }
        }

        # TODO(manas) : register action types here for now. RunnerType registration can be moved
        # to posting to /runnertypes but that implies implementing POST.
        runners_registrar.register_runner_types()

        cls.app = TestApp(auth.AuthMiddleware(load_app(cfg_dict)))
Ejemplo n.º 16
0
 def setUpClass(cls):
     super(ExecutionCancellationTest, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
Ejemplo n.º 17
0
 def setUpClass(cls):
     super(ExecutionCancellationTest, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))