Support Yardstick to push results to database 97/34397/4
authorxudan <xudan16@huawei.com>
Sat, 6 May 2017 08:46:17 +0000 (04:46 -0400)
committerxudan <xudan16@huawei.com>
Tue, 9 May 2017 11:50:07 +0000 (07:50 -0400)
JIRA: DOVETAIL-421

1. Yardstick is working on supporting push results to mongoDB.
   see https://gerrit.opnfv.org/gerrit/#/c/34091/
2. make Dovetail supporting push results to database too when
   user choose to report to database.

Change-Id: Iee06ad6be59dad62ac4f985f4a982fb5ff93a592
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/container.py
dovetail/run.py

index ae7c8e2..67e26f6 100644 (file)
@@ -100,8 +100,9 @@ class Container(object):
             return None
 
         if dovetail_config['report_dest'].startswith("http"):
-            cls.logger.info("Yardstick can't push results to DB.")
-            cls.logger.info("Results will be stored with files.")
+            envs = envs + " -e DISPATCHER=http"
+            envs = envs + " -e TARGET=%s" % dovetail_config['report_dest']
+            envs = envs + " -e NODE_NAME=master"
 
         log_vol = '-v %s:%s ' % (dovetail_config['result_dir'],
                                  dovetail_config["yardstick"]['result']['log'])
index 5b4dca8..a191e39 100755 (executable)
@@ -77,19 +77,14 @@ def check_tc_result(testcase, logger):
     dovetail_result = os.path.join(result_dir,
                                    dt_cfg.dovetail_config['result_file'])
     if dt_cfg.dovetail_config['report_dest'].startswith("http"):
-        if validate_type.lower() == 'yardstick':
-            logger.info("Results have been stored with file %s.",
-                        os.path.join(result_dir,
-                                     testcase.validate_testcase() + '.out'))
+        if dt_utils.store_db_results(dt_cfg.dovetail_config['report_dest'],
+                                     dt_cfg.dovetail_config['build_tag'],
+                                     testcase.name(), dovetail_result,
+                                     logger):
+            logger.info("Results have been pushed to database and stored "
+                        "with local file %s.", dovetail_result)
         else:
-            if dt_utils.store_db_results(dt_cfg.dovetail_config['report_dest'],
-                                         dt_cfg.dovetail_config['build_tag'],
-                                         testcase.name(), dovetail_result,
-                                         logger):
-                logger.info("Results have been pushed to database and stored "
-                            "with local file %s.", dovetail_result)
-            else:
-                logger.error("Fail to push results to database.")
+            logger.error("Fail to push results to database.")
     if dt_cfg.dovetail_config['report_dest'] == "file":
         if validate_type.lower() == 'yardstick':
             logger.info("Results have been stored with file %s.",