Example #1
0
    def use(self, verification):
        """Set active verification. Alias for "rally use verification"

        :param verification: a UUID of verification
        """
        print("Verification UUID: %s" % verification)
        db.verification_get(verification)
        fileutils.update_globals_file("RALLY_VERIFICATION", verification)
Example #2
0
    def use(self, verification):
        """Set active verification.

        :param verification: a UUID of verification
        """
        print("Verification UUID: %s" % verification)
        db.verification_get(verification)
        fileutils.update_globals_file("RALLY_VERIFICATION", verification)
Example #3
0
    def test_creation_of_verification(self):
        verification = self._create_verification()
        db_verification = db.verification_get(verification["uuid"])

        self.assertEqual(verification["tests"], db_verification["tests"])
        self.assertEqual(verification["time"], db_verification["time"])
        self.assertEqual(verification["errors"], db_verification["errors"])
        self.assertEqual(verification["failures"], db_verification["failures"])
Example #4
0
    def test_creation_of_verification(self):
        verification = self._create_verification()
        db_verification = db.verification_get(verification["uuid"])

        self.assertEqual(verification["tests"], db_verification["tests"])
        self.assertEqual(verification["time"], db_verification["time"])
        self.assertEqual(verification["errors"], db_verification["errors"])
        self.assertEqual(verification["failures"], db_verification["failures"])
Example #5
0
    def test_verification_result_create_and_get(self):
        verification = self._create_verification()
        db_verification = db.verification_get(verification["uuid"])

        ver_result1 = db.verification_result_create(
            db_verification["uuid"], {})
        ver_result2 = db.verification_result_get(db_verification["uuid"])
        self.assertEqual(ver_result1["verification_uuid"],
                         ver_result2["verification_uuid"])
Example #6
0
    def test_verification_result_create_and_get(self):
        verification = self._create_verification()
        db_verification = db.verification_get(verification["uuid"])

        ver_result1 = db.verification_result_create(db_verification["uuid"],
                                                    {})
        ver_result2 = db.verification_result_get(db_verification["uuid"])
        self.assertEqual(ver_result1["verification_uuid"],
                         ver_result2["verification_uuid"])
Example #7
0
def get_verification_results(verification_uuid):
    detailed = flask.request.args.get('detailed', False) and True

    verification = db.verification_get(verification_uuid)
    results = db.verification_result_get(verification_uuid)['data']

    if detailed:
        return flask.jsonify(results)
    else:
        return flask.jsonify(verification._as_dict())
Example #8
0
    def show(self, verification_uuid=None, sort_by="name", detailed=False):
        """Display results table of the verification."""

        try:
            sortby_index = ("name", "duration").index(sort_by)
        except ValueError:
            print("Sorry, but verification results can't be sorted "
                  "by '%s'." % sort_by)
            return 1

        try:
            verification = db.verification_get(verification_uuid)
            tests = db.verification_result_get(verification_uuid)
        except exceptions.NotFoundException as e:
            print(six.text_type(e))
            return 1

        print("Total results of verification:\n")
        total_fields = [
            "UUID", "Deployment UUID", "Set name", "Tests", "Failures",
            "Created at", "Status"
        ]
        cliutils.print_list([verification], fields=total_fields)

        print("\nTests:\n")
        fields = ["name", "time", "status"]

        values = [
            objects.Verification(test)
            for test in six.itervalues(tests.data["test_cases"])
        ]
        cliutils.print_list(values, fields, sortby_index=sortby_index)

        if detailed:
            for test in six.itervalues(tests.data["test_cases"]):
                if test["status"] == "FAIL":
                    header = cliutils.make_header(
                        "FAIL: %(name)s\n"
                        "Time: %(time)s\n"
                        "Type: %(type)s" % {
                            "name": test["name"],
                            "time": test["time"],
                            "type": test["failure"]["type"]
                        })
                    formatted_test = "%(header)s%(log)s\n" % {
                        "header": header,
                        "log": test["failure"]["log"]
                    }
                    print(formatted_test)
Example #9
0
    def show(self, verification_uuid=None, sort_by="name", detailed=False):
        """Display results table of the verification."""

        try:
            sortby_index = ("name", "duration").index(sort_by)
        except ValueError:
            print("Sorry, but verification results can't be sorted "
                  "by '%s'." % sort_by)
            return 1

        try:
            verification = db.verification_get(verification_uuid)
            tests = db.verification_result_get(verification_uuid)
        except exceptions.NotFoundException as e:
            print(six.text_type(e))
            return 1

        print ("Total results of verification:\n")
        total_fields = ["UUID", "Deployment UUID", "Set name", "Tests",
                        "Failures", "Created at", "Status"]
        cliutils.print_list([verification], fields=total_fields)

        print ("\nTests:\n")
        fields = ["name", "time", "status"]

        values = [objects.Verification(test)
                  for test in six.itervalues(tests.data["test_cases"])]
        cliutils.print_list(values, fields, sortby_index=sortby_index)

        if detailed:
            for test in six.itervalues(tests.data["test_cases"]):
                if test["status"] == "FAIL":
                    header = cliutils.make_header(
                        "FAIL: %(name)s\n"
                        "Time: %(time)s\n"
                        "Type: %(type)s" % {"name": test["name"],
                                            "time": test["time"],
                                            "type": test["failure"]["type"]})
                    formatted_test = "%(header)s%(log)s\n" % {
                        "header": header,
                        "log": test["failure"]["log"]}
                    print (formatted_test)
Example #10
0
 def get(cls, uuid):
     return cls(db.verification_get(uuid))
Example #11
0
 def test_verification_get(self):
     v = db.verification_get(self._create_verification()["uuid"])
     self.assertEqual(self.verifier["uuid"], v["verifier_uuid"])
     self.assertEqual(self.deploy["uuid"], v["deployment_uuid"])
Example #12
0
 def test_verification_get(self):
     v = db.verification_get(self._create_verification()["uuid"])
     self.assertEqual(self.verifier["uuid"], v["verifier_uuid"])
     self.assertEqual(self.env["uuid"], v["env_uuid"])
Example #13
0
def get_verification(verification_uuid):
    verification = db.verification_get(verification_uuid)
    return flask.jsonify({"verification": verification._as_dict()})
Example #14
0
 def test_verification_get(self):
     v = db.verification_get(self._create_verification()["uuid"])
     self.assertEqual(self.verifier["uuid"], v["verifier_uuid"])
     self.assertEqual(self.env["uuid"], v["env_uuid"])
Example #15
0
 def test_verification_get(self):
     v = db.verification_get(self._create_verification()["uuid"])
     self.assertEqual(self.verifier["uuid"], v["verifier_uuid"])
     self.assertEqual(self.deploy["uuid"], v["deployment_uuid"])