コード例 #1
0
def tempest_tests_exists(config, clients, task):
    """Validator checks that specified test exists."""
    args = config.get("args", {})

    if "test_name" in args:
        tests = [args["test_name"]]
    else:
        tests = args.get("test_names", [])

    if not tests:
        return ValidationResult(
            False, "Parameter 'test_name' or 'test_names' should "
            "be specified.")
    verifier = tempest.Tempest(task["deployment_uuid"])
    if not verifier.is_installed():
        verifier.install()
    if not verifier.is_configured():
        verifier.generate_config_file()

    allowed_tests = verifier.discover_tests()

    for i, test in enumerate(tests):
        if not test.startswith("tempest.api."):
            tests[i] = "tempest.api." + test

    wrong_tests = set(tests) - allowed_tests

    if not wrong_tests:
        return ValidationResult()
    else:
        message = (_("One or more tests not found: '%s'") %
                   "', '".join(sorted(wrong_tests)))
        return ValidationResult(False, message)
コード例 #2
0
    def setup(self):
        self.verifier = tempest.Tempest(self.task.task.deployment_uuid)
        self.verifier.log_file = "/dev/null"

        try:
            if not self.verifier.is_installed():
                self.verifier.install()
            if not self.verifier.is_configured():
                self.verifier.generate_config_file()
        except exceptions.TempestSetupFailure:
            msg = _("Failing to install tempest.")
            LOG.error(msg)
            raise exceptions.BenchmarkSetupFailure(msg)
        except exceptions.TempestConfigCreationFailure:
            msg = _("Failing to configure tempest.")
            LOG.error(msg)
            raise exceptions.BenchmarkSetupFailure(msg)

        self.context["verifier"] = self.verifier

        # Create temporary directory for xml-results.
        self.results_dir = os.path.join(tempfile.gettempdir(),
                                        "%s-results" % self.task.task.uuid)
        os.mkdir(self.results_dir)
        self.context["tmp_results_dir"] = self.results_dir
コード例 #3
0
    def tempest_test_exists_validator(**kwargs):
        verifier = tempest.Tempest(kwargs["task"].task.deployment_uuid)
        if not verifier.is_installed():
            verifier.install()
        if not verifier.is_configured():
            verifier.generate_config_file()

        allowed_tests = verifier.discover_tests()

        if "test_name" in kwargs:
            tests = [kwargs["test_name"]]
        else:
            tests = kwargs["test_names"]

        for test in tests:
            if (not test.startswith("tempest.api.")
                    and test.split(".")[0] in consts.TEMPEST_TEST_SETS):
                tests[tests.index(test)] = "tempest.api." + test

        wrong_tests = set(tests) - allowed_tests

        if not wrong_tests:
            return ValidationResult()
        else:
            message = (_("One or more tests not found: '%s'") %
                       "', '".join(sorted(wrong_tests)))
            return ValidationResult(False, message)
コード例 #4
0
    def tempest_test_exists_validator(**kwargs):
        verifier = tempest.Tempest(kwargs['task'].task.deployment_uuid)
        if not verifier.is_installed():
            verifier.install()
        if not verifier.is_configured():
            verifier.generate_config_file()

        allowed_tests = verifier.discover_tests()

        if 'test_name' in kwargs:
            tests = [kwargs['test_name']]
        else:
            tests = kwargs['test_names']

        for test in tests:
            if not test.startswith('tempest.api.'):
                tests[tests.index(test)] = 'tempest.api.' + test

        wrong_tests = set(tests) - set(allowed_tests)

        if not wrong_tests:
            return ValidationResult()
        else:
            message = (_("One or more tests not found: '%s'") %
                       "', '".join(wrong_tests))
            return ValidationResult(False, message)
コード例 #5
0
ファイル: test_tempest.py プロジェクト: sahanasj/rally
    def setUp(self):
        super(BaseTestCase, self).setUp()
        self.verifier = tempest.Tempest('fake_deploy_id',
                                        verification=mock.MagicMock())

        self.verifier._path = "/tmp"
        self.verifier.config_file = "/tmp/tempest.conf"
        self.verifier.log_file_raw = "/tmp/subunit.stream"
コード例 #6
0
    def setUp(self):
        super(TempestTestCase, self).setUp()
        self.verifier = tempest.Tempest('fake_deploy_id',
                                        verification=mock.MagicMock())

        self.verifier.tempest_path = '/tmp'
        self.verifier.config_file = '/tmp/tempest.conf'
        self.verifier.log_file_raw = '/tmp/subunit.stream'
        self.regex = None
コード例 #7
0
 def setUp(self):
     super(TempestScenarioTestCase, self).setUp()
     self.verifier = verifier.Tempest("fake_uuid")
     self.verifier.log_file = "/dev/null"
     self.verifier.parse_results = mock.MagicMock()
     self.verifier.parse_results.return_value = ({"fake": True},
                                                 {"have_results": True})
     self.context = {"verifier": self.verifier,
                     "tmp_results_dir": "/dev"}
     self.scenario = tempest.TempestScenario(self.context)
     self.scenario._add_atomic_actions = mock.MagicMock()
コード例 #8
0
ファイル: api.py プロジェクト: kambiz-aghaiepour/rally
def destroy_deploy(deploy_uuid):
    """Destroy the deployment.

    :param deploy_uuid: UUID of the deployment
    """
    # TODO(akscram): We have to be sure that there are no running
    #                tasks for this deployment.
    # TODO(akscram): Check that the deployment have got a status that
    #                is equal to "*->finished" or "deploy->inconsistent".
    deployment = objects.Deployment.get(deploy_uuid)
    deployer = deploy.EngineFactory.get_engine(deployment['config']['type'],
                                               deployment)
    with deployer:
        deployer.make_cleanup()
        deployment.delete()

    tempest.Tempest(deploy_uuid).uninstall()
コード例 #9
0
ファイル: api.py プロジェクト: kambiz-aghaiepour/rally
def verify(deploy_id, set_name, regex):
    """Start verifying.

    :param deploy_id: a UUID of a deployment.
    :param set_name: Valid name of tempest test set.
    :param regex: Regular expression of test
    """

    verification = objects.Verification(deployment_uuid=deploy_id)
    verifier = tempest.Tempest(deploy_id, verification=verification)
    if not verifier.is_installed():
        print("Tempest is not installed for specified deployment.")
        print("Installing Tempest for deployment %s" % deploy_id)
        verifier.install()
    LOG.info("Starting verification of deployment: %s" % deploy_id)

    verification.set_running()
    verifier.verify(set_name=set_name, regex=regex)
コード例 #10
0
    def setup(self):
        self.verifier = tempest.Tempest(self.task.task.deployment_uuid)
        self.verifier.log_file = "/dev/null"

        try:
            if not self.verifier.is_installed():
                self.verifier.install()
            if not self.verifier.is_configured():
                self.verifier.generate_config_file()
        except exceptions.TempestSetupFailure:
            msg = _("Failing to install tempest.")
            LOG.error(msg)
            raise exceptions.BenchmarkSetupFailure(msg)
        except exceptions.TempestConfigCreationFailure:
            msg = _("Failing to configure tempest.")
            LOG.error(msg)
            raise exceptions.BenchmarkSetupFailure(msg)

        self.context["verifier"] = self.verifier
コード例 #11
0
 def install(self, deploy_id=None):
     """Install tempest."""
     verifier = tempest.Tempest(deploy_id)
     verifier.install()
コード例 #12
0
 def setUp(self):
     super(TempestScenarioTestCase, self).setUp()
     self.verifier = verifier.Tempest("fake_uuid")
     self.verifier.log_file = "/dev/null"
     self.context = {"verifier": self.verifier}
     self.scenario = tempest.TempestScenario(self.context)