Fix print when push_results_to_db fails
[functest.git] / utils / functest_utils.py
index d020eba..b83309e 100644 (file)
@@ -169,9 +169,18 @@ def logger_test_results(logger, project, case_name, status, details):
     version = get_version(logger)
     build_tag = get_build_tag(logger)
 
-    logger.info("Pushing %(p)s/%(n)s results: TEST_DB_URL=%(db)s "
-                "pod_name=%(pod)s version=%(v)s scenario=%(s)s "
-                "criteria=%(c)s details=%(d)s" % {
+    logger.info("\n"
+                "****************************************\n"
+                "\t %(p)s/%(n)s results \n\n"
+                "****************************************\n"
+                "DB:\t%(db)s\n"
+                "pod:\t%(pod)s\n"
+                "version:\t%(v)s\n"
+                "scenario:\t%(s)s\n"
+                "status:\t%(c)s\n"
+                "build tag:\t%(b)s\n"
+                "details:\t%(d)s\n"
+                % {
                     'p': project,
                     'n': case_name,
                     'db': get_db_url(),
@@ -210,10 +219,11 @@ def push_results_to_db(project, case_name, logger,
         r = requests.post(url, data=json.dumps(params), headers=headers)
         if logger:
             logger.debug(r)
+        r.raise_for_status()
         return True
     except Exception, e:
-        print("Error [push_results_to_db('%s', '%s', '%s', " +
-              "'%s', '%s', '%s', '%s', '%s', '%s')]:" %
+        print("Error [push_results_to_db('%s', '%s', '%s', '%s',"
+              "'%s', '%s', '%s', '%s', '%s')]:" %
               (url, project, case_name, pod_name, version,
                scenario, criteria, build_tag, details)), e
         return False