adapt mong_to_elasticsearch.py to testAPI 93/15793/1
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Fri, 17 Jun 2016 06:49:27 +0000 (14:49 +0800)
committerSerenaFeng <feng.xiaowei@zte.com.cn>
Fri, 17 Jun 2016 06:49:27 +0000 (14:49 +0800)
change test_results to results in the url

JIRA: FUNCTEST-321

Change-Id: I5621ec48ac0cfd6239a07fcd0b83b5418a1ed5f4
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
utils/test/scripts/mongo_to_elasticsearch.py

index 51b6913..beae959 100644 (file)
@@ -354,7 +354,7 @@ def modify_mongo_entry(testcase):
 def publish_mongo_data(output_destination):
     tmp_filename = 'mongo-{}.log'.format(uuid.uuid4())
     try:
-        subprocess.check_call(['mongoexport', '--db', 'test_results_collection', '-c', 'test_results', '--out',
+        subprocess.check_call(['mongoexport', '--db', 'test_results_collection', '-c', 'results', '--out',
                                tmp_filename])
         with open(tmp_filename) as fobj:
             for mongo_json_line in fobj:
@@ -368,7 +368,7 @@ def publish_mongo_data(output_destination):
 
 def get_mongo_data(days):
     past_time = datetime.datetime.today() - datetime.timedelta(days=days)
-    mongo_json_lines = subprocess.check_output(['mongoexport', '--db', 'test_results_collection', '-c', 'test_results',
+    mongo_json_lines = subprocess.check_output(['mongoexport', '--db', 'test_results_collection', '-c', 'results',
                                                 '--query', '{{"creation_date":{{$gt:"{}"}}}}'
                                                .format(past_time)]).splitlines()
 
@@ -417,7 +417,7 @@ if __name__ == '__main__':
                         help='the url of mongodb, defaults to http://localhost:8082')
 
     args = parser.parse_args()
-    base_elastic_url = urlparse.urljoin(args.elasticsearch_url, '/test_results/mongo2elastic')
+    base_elastic_url = urlparse.urljoin(args.elasticsearch_url, '/results/mongo2elastic')
     output_destination = args.output_destination
     days = args.merge_latest
     es_user = args.elasticsearch_username