コード例 #1
0
ファイル: TestManager.py プロジェクト: baikai/cloudpulse
 def __init__(self):
     self.command_ref = {}
     discover.import_modules_from_package("cloudpulse.scenario.plugins")
     for scenario_group in discover.itersubclasses(base.Scenario):
         for method in dir(scenario_group):
             scenario = scenario_group()
             callback = getattr(scenario, method)
             self.command_ref[method] = callback
コード例 #2
0
ファイル: utils.py プロジェクト: schoksey/cloudpulse
def get_rpc_resource_detail(resource, resource_ident):
    resource = getattr(objects, resource)
    test = resource.get_by_uuid(pecan.request.context, resource_ident)
    discover.import_modules_from_package("cloudpulse.scenario.plugins")
    for scenario_group in discover.itersubclasses(base.Scenario):
        for method in dir(scenario_group):
            if test['name'] == method:
                scenario = scenario_group()
                callback = getattr(scenario, 'verbose')
    return callback()
コード例 #3
0
ファイル: utils.py プロジェクト: baikai/cloudpulse
def get_rpc_resource_detail(resource, resource_ident):
    resource = getattr(objects, resource)
    test = resource.get_by_uuid(pecan.request.context, resource_ident)
    discover.import_modules_from_package("cloudpulse.scenario.plugins")
    for scenario_group in discover.itersubclasses(base.Scenario):
        for method in dir(scenario_group):
            if test['name'] == method:
                scenario = scenario_group()
                callback = getattr(scenario, 'verbose')
    return callback()
コード例 #4
0
 def __init__(self):
     self.command_ref = {}
     self.conductor_id = '1'
     discover.import_modules_from_package("cloudpulse.scenario.plugins")
     for scenario_group in discover.itersubclasses(base.Scenario):
         for method in dir(scenario_group):
             LOG.debug(
                 ('Adding test %s from %s') % (method, scenario_group))
             scenario = scenario_group()
             callback = getattr(scenario, method)
             self.command_ref[method] = callback
コード例 #5
0
ファイル: TestManager.py プロジェクト: openstack/cloudpulse
 def __init__(self):
     self.command_ref = {}
     self.conductor_id = '1'
     discover.import_modules_from_package("cloudpulse.scenario.plugins")
     for scenario_group in discover.itersubclasses(base.Scenario):
         for method in dir(scenario_group):
             LOG.debug(('Adding test %s from %s') %
                       (method, scenario_group))
             scenario = scenario_group()
             callback = getattr(scenario, method)
             self.command_ref[method] = callback
コード例 #6
0
    def list_all_scenarios(scenario_cls):
        """Lists all the existing methods in the operator scenario classes.

        Returns the method names in format <Class name>.<Method name>, which
        is used in the test config.

        :returns: List of strings
        """
        scenario_classes = (list(discover.itersubclasses(scenario_cls)) +
                            [scenario_cls])
        scenarios_list = [[
            "%s.%s" % (scenario.__name__, func) for func in dir(scenario)
            if Scenario.is_scenario(scenario, func)
        ] for scenario in scenario_classes]
        scenarios_list_flat = list(
            itertools.chain.from_iterable(scenarios_list))
        return scenarios_list_flat
コード例 #7
0
ファイル: base.py プロジェクト: baikai/cloudpulse
    def list_all_scenarios(scenario_cls):
        """Lists all the existing methods in the operator scenario classes.

        Returns the method names in format <Class name>.<Method name>, which
        is used in the test config.

        :returns: List of strings
        """
        scenario_classes = (list(discover.itersubclasses(scenario_cls)) +
                            [scenario_cls])
        scenarios_list = [
            ["%s.%s" % (scenario.__name__, func)
             for func in dir(scenario) if Scenario.is_scenario(scenario, func)]
            for scenario in scenario_classes
        ]
        scenarios_list_flat = list(
            itertools.chain.from_iterable(scenarios_list))
        return scenarios_list_flat
コード例 #8
0
ファイル: api.py プロジェクト: anand1712/cloudpulse
    def create_test(self, values):
        # ensure that  the test name is valid
        discover.import_modules_from_package("cloudpulse.scenario.plugins")
        plugins = discover.itersubclasses(base.Scenario)
        if not any(values['name'] in dir(scenario) for scenario in plugins):
            raise exception.TestInvalid(test=values['name'])

        # ensure defaults are present for new tests
        if not values.get('uuid'):
            values['uuid'] = utils.generate_uuid()

        cpulse = models.cpulse()
        cpulse.update(values)
        # TODO(VINOD)
        try:
            cpulse.save()
        except db_exc.DBDuplicateEntry:
            raise exception.TestAlreadyExists(uuid=values['uuid'])
        return cpulse
コード例 #9
0
ファイル: api.py プロジェクト: schoksey/cloudpulse
    def create_test(self, values):
        # ensure that  the test name is valid
        discover.import_modules_from_package("cloudpulse.scenario.plugins")
        plugins = discover.itersubclasses(base.Scenario)
        if not any(values['name'] in dir(scenario) for scenario in plugins):
            raise exception.TestInvalid(test=values['name'])

        # ensure defaults are present for new tests
        if not values.get('uuid'):
            values['uuid'] = utils.generate_uuid()

        cpulse = models.cpulse()
        cpulse.update(values)
        # TODO(VINOD)
        try:
            cpulse.save()
        except db_exc.DBDuplicateEntry:
            raise exception.TestAlreadyExists(uuid=values['uuid'])
        return cpulse
コード例 #10
0
ファイル: all_tests.py プロジェクト: openstack/cloudpulse
 def all_tests(self):
     enabled_scenarios = cfg.CONF.scenario.enabled_scenarios
     all_cases = []
     result = 200
     resultmsg = ''
     discover.import_modules_from_package("cloudpulse.scenario.plugins")
     for scenario_group in discover.itersubclasses(base.Scenario):
         if scenario_group.__name__ in enabled_scenarios:
             all_cases += [getattr(scenario_group(), method)
                           for method in dir(scenario_group)
                           if method.startswith("all")]
     for func in all_cases:
         try:
             funres = func()
         except Exception as e:
             funres = [404, str(e)]
         if funres[0] != 200:
             resultmsg += ("%s\n\n" % (funres[1]))
             result = 404
     if not resultmsg:
         resultmsg = "All Tests passed"
     return (result, resultmsg)
コード例 #11
0
 def all_tests(self):
     enabled_scenarios = cfg.CONF.scenario.enabled_scenarios
     all_cases = []
     result = 200
     resultmsg = ''
     discover.import_modules_from_package("cloudpulse.scenario.plugins")
     for scenario_group in discover.itersubclasses(base.Scenario):
         if scenario_group.__name__ in enabled_scenarios:
             all_cases += [
                 getattr(scenario_group(), method)
                 for method in dir(scenario_group)
                 if method.startswith("all")
             ]
     for func in all_cases:
         try:
             funres = func()
         except Exception as e:
             funres = [404, str(e)]
         if funres[0] != 200:
             resultmsg += ("%s\n\n" % (funres[1]))
             result = 404
     if not resultmsg:
         resultmsg = "All Tests passed"
     return (result, resultmsg)
コード例 #12
0
ファイル: base.py プロジェクト: baikai/cloudpulse
 def get_by_name(name):
     """Returns Scenario class by name."""
     for scenario in discover.itersubclasses(Scenario):
         if name == scenario.__name__:
             return scenario
     raise exception.NoSuchScenario(name=name)
コード例 #13
0
 def get_by_name(name):
     """Returns Scenario class by name."""
     for scenario in discover.itersubclasses(Scenario):
         if name == scenario.__name__:
             return scenario
     raise exception.NoSuchScenario(name=name)