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 verification(self, verification_id): """Set active verification. :param verification_id: a UUID of verification """ print('Verification UUID: %s' % verification_id) self._ensure_rally_configuration_dir_exists() db.verification_get(verification_id) self._update_attribute_in_global_file('RALLY_VERIFICATION', verification_id)
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_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 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" ] common_cliutils.print_list([verification], fields=total_fields) print("\nTests:\n") fields = ["name", "time", "status"] values = map(objects.Verification, six.itervalues(tests.data["test_cases"])) common_cliutils.print_list(values, fields, sortby_index=sortby_index) if detailed: for test in six.itervalues(tests.data["test_cases"]): if test["status"] == "FAIL": formatted_test = ( "=====================================================" "=================\n" "FAIL: %(name)s\n" "Time: %(time)s\n" "Type: %(type)s\n" "-----------------------------------------------------" "-----------------\n" "%(log)s\n") % { "name": test["name"], "time": test["time"], "type": test["failure"]["type"], "log": test["failure"]["log"] } print(formatted_test)
def show(self, verification_uuid, sort_by='name', detailed=False): 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' ] common_cliutils.print_list([verification], fields=total_fields) print("\nTests:\n") fields = ['name', 'time', 'status'] values = map(objects.Verification, six.itervalues(tests.data['test_cases'])) common_cliutils.print_list(values, fields, sortby_index=sortby_index) if detailed: for test in six.itervalues(tests.data['test_cases']): if test['status'] == 'FAIL': formatted_test = ( '=====================================================' '=================\n' 'FAIL: %(name)s\n' 'Time: %(time)s\n' 'Type: %(type)s\n' '-----------------------------------------------------' '-----------------\n' '%(log)s\n') % { 'name': test['name'], 'time': test['time'], 'type': test['failure']['type'], 'log': test['failure']['log'] } print(formatted_test)
def show(self, verification_uuid, sort_by='name', detailed=False): 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'] common_cliutils.print_list([verification], fields=total_fields, sortby_index=total_fields.index( 'Created at')) print ("\nTests:\n") fields = ['name', 'time', 'status'] values = map(objects.Verification, six.itervalues(tests.data['test_cases'])) common_cliutils.print_list(values, fields, sortby_index=sortby_index) if detailed: for test in six.itervalues(tests.data['test_cases']): if test['status'] == 'FAIL': formatted_test = ( '=====================================================' '=================\n' 'FAIL: %(name)s\n' 'Time: %(time)s\n' 'Type: %(type)s\n' '-----------------------------------------------------' '-----------------\n' '%(log)s\n' ) % { 'name': test['name'], 'time': test['time'], 'type': test['failure']['type'], '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"] common_cliutils.print_list([verification], fields=total_fields) print ("\nTests:\n") fields = ["name", "time", "status"] values = map(objects.Verification, six.itervalues(tests.data["test_cases"])) common_cliutils.print_list(values, fields, sortby_index=sortby_index) if detailed: for test in six.itervalues(tests.data["test_cases"]): if test["status"] == "FAIL": formatted_test = ( "=====================================================" "=================\n" "FAIL: %(name)s\n" "Time: %(time)s\n" "Type: %(type)s\n" "-----------------------------------------------------" "-----------------\n" "%(log)s\n" ) % { "name": test["name"], "time": test["time"], "type": test["failure"]["type"], "log": test["failure"]["log"]} print (formatted_test)
def get(cls, uuid): return cls(db.verification_get(uuid))