add report flag to parser
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Thu, 11 Aug 2016 08:58:35 +0000 (16:58 +0800)
committerSerenaFeng <feng.xiaowei@zte.com.cn>
Thu, 11 Aug 2016 08:58:35 +0000 (16:58 +0800)
parser has no report flag, every time we run the test the results will be reported to db

JIRA: FUNCTEST-410

Change-Id: I6336b4c367fd8edc70e076b81d01d9356580bc22
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
ci/exec_test.sh
testcases/vnf/vRNC/parser.py

index 97b567a..9951c09 100755 (executable)
@@ -173,7 +173,7 @@ function run_test(){
             python ${FUNCTEST_REPO_DIR}/testcases/features/sfc/sfc.py
         ;;
         "parser")
-            python ${FUNCTEST_REPO_DIR}/testcases/vnf/vRNC/parser.py
+            python ${FUNCTEST_REPO_DIR}/testcases/vnf/vRNC/parser.py $report
         ;;
         *)
             echo "The test case '${test_name}' does not exist."
index d5d3f78..9678591 100644 (file)
 import os
 import time
 import yaml
+import argparse
 
 import functest.utils.functest_logger as ft_logger
 import functest.utils.functest_utils as functest_utils
 
+parser = argparse.ArgumentParser()
+parser.add_argument("-r", "--report",
+                    help="Create json result file",
+                    action="store_true")
+args = parser.parse_args()
+
 with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
     functest_yaml = yaml.safe_load(f)
 
@@ -51,13 +58,15 @@ def main():
                                        status,
                                        details)
 
-    functest_utils.push_results_to_db(project,
-                                      case_name,
-                                      logger,
-                                      start_time,
-                                      stop_time,
-                                      status,
-                                      details)
+    if args.report:
+        logger.debug("Report Parser Results to DB......")
+        functest_utils.push_results_to_db(project,
+                                          case_name,
+                                          logger,
+                                          start_time,
+                                          stop_time,
+                                          status,
+                                          details)
     exit(ret)
 
 if __name__ == '__main__':