diff options
-rwxr-xr-x | testcases/Controllers/ODL/OpenDaylightTesting.py | 36 | ||||
-rw-r--r-- | testcases/OpenStack/vPing/vping_util.py | 2 | ||||
-rwxr-xr-x | testcases/features/sfc/set-up-tacker.sh | 8 | ||||
-rw-r--r-- | utils/functest_utils.py | 5 |
4 files changed, 33 insertions, 18 deletions
diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py index 74e3157dc..2806b4f22 100755 --- a/testcases/Controllers/ODL/OpenDaylightTesting.py +++ b/testcases/Controllers/ODL/OpenDaylightTesting.py @@ -59,7 +59,8 @@ class ODLTestCases: shutil.copy(f, cls.neutron_suite_dir) except IOError as e: cls.logger.error( - "Cannot copy OPNFV's testcases to ODL directory", e) + "Cannot copy OPNFV's testcases to ODL directory: " + "%s" % e.strerror) return False return True @@ -67,7 +68,6 @@ class ODLTestCases: def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"): odl_variables_files = cls.odl_test_repo + 'csit/variables/Variables.py' try: - cls.logger.debug(cls.neutron_suite_dir + '__init__.robot') for line in fileinput.input(odl_variables_files, inplace=True): print re.sub("AUTH = .*", @@ -76,7 +76,7 @@ class ODLTestCases: line.rstrip()) return True except Exception as e: - cls.logger.error("Cannot set ODL creds", e) + cls.logger.error("Cannot set ODL creds: %s" % e.strerror) return False @classmethod @@ -94,7 +94,8 @@ class ODLTestCases: 'PORT:' + kwargs['odlwebport'], 'RESTCONFPORT:' + kwargs['odlrestconfport']] except KeyError as e: - cls.logger.error("Cannot run ODL testcases. Please check", e) + cls.logger.error("Cannot run ODL testcases. Please check " + "%s" % e.strerror) return False if (cls.copy_opnf_testcases() and cls.set_robotframework_vars(odlusername, odlpassword)): @@ -103,17 +104,20 @@ class ODLTestCases: except OSError: pass stdout_file = cls.res_dir + 'stdout.txt' - with open(stdout_file, 'w') as stdout: - result = run(*dirs, variable=variables, - output=cls.res_dir + 'output.xml', - log=cls.res_dir + 'log.html', - report=cls.res_dir + 'report.html', - stdout=stdout) - - with open(stdout_file, 'r') as stdout: + with open(stdout_file, 'w+') as stdout: + run(*dirs, variable=variables, + output=cls.res_dir + 'output.xml', + log='NONE', + report='NONE', + stdout=stdout) + stdout.seek(0, 0) cls.logger.info("\n" + stdout.read()) - - return result + cls.logger.info("ODL results were successfully generated") + try: + os.remove(stdout_file) + except OSError: + pass + return True else: return False @@ -134,6 +138,7 @@ class ODLTestCases: cls.logger.error("Cannot push ODL results to DB") return False else: + cls.logger.info("ODL results were successfully pushed to DB") return True except RobotError as e: cls.logger.error("Run tests before publishing: %s" % e.message) @@ -176,7 +181,8 @@ if __name__ == '__main__': action='store_true') args = vars(parser.parse_args()) - ODLTestCases.run(**args) + if not ODLTestCases.run(**args): + sys.exit(os.EX_SOFTWARE) if args['pushtodb']: sys.exit(not ODLTestCases.push_to_db()) sys.exit(os.EX_OK) diff --git a/testcases/OpenStack/vPing/vping_util.py b/testcases/OpenStack/vPing/vping_util.py index 42ab699d9..d3e081f6d 100644 --- a/testcases/OpenStack/vPing/vping_util.py +++ b/testcases/OpenStack/vPing/vping_util.py @@ -166,6 +166,8 @@ def create_image(): exit(EXIT_CODE) logger.debug("Image '%s' with ID=%s created successfully." % (GLANCE_IMAGE_NAME, image_id)) + image_exists = True + return image_exists, image_id diff --git a/testcases/features/sfc/set-up-tacker.sh b/testcases/features/sfc/set-up-tacker.sh index da2cb922e..e88893391 100755 --- a/testcases/features/sfc/set-up-tacker.sh +++ b/testcases/features/sfc/set-up-tacker.sh @@ -1,6 +1,8 @@ -git_commit=ee3046f24df0bfca7ee15501f6c06ad86dd462c2 -curl "https://gerrit.opnfv.org/gerrit/gitweb?p=fuel.git;a=blob_plain;\ -f=prototypes/sfc_tacker/poc.tacker-up.sh;hb=${git_commit}" > poc.tacker-up.sh +git clone https://gerrit.opnfv.org/gerrit/fuel fuel +pushd fuel +git checkout e7f7abc89161441548545f79f0299610c6e5b203 +popd +mv fuel/prototypes/sfc_tacker/poc.tacker-up.sh . bash poc.tacker-up.sh cat <<EOF > delete.sh diff --git a/utils/functest_utils.py b/utils/functest_utils.py index b83309e3a..807a671a3 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -221,6 +221,11 @@ def push_results_to_db(project, case_name, logger, logger.debug(r) r.raise_for_status() return True + except requests.RequestException: + if logger: + logger.error("Pushing Result to DB(%s) failed: %s" % + (r.url, r.content)) + return False except Exception, e: print("Error [push_results_to_db('%s', '%s', '%s', '%s'," "'%s', '%s', '%s', '%s', '%s')]:" % |