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)
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)
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"])
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"])
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"])
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())
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)
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)
def get(cls, uuid): return cls(db.verification_get(uuid))
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"])
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"])
def get_verification(verification_uuid): verification = db.verification_get(verification_uuid) return flask.jsonify({"verification": verification._as_dict()})