summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2016-06-13 03:38:30 -0400
committerMatthewLi <matthew.lijun@huawei.com>2016-06-13 03:43:53 -0400
commit602354a46dcddfa0636ae8cf69044546b8ff437e (patch)
tree84738b22d1e12fdf3519414cc7621fe2da82dd5b /testsuites
parent48cc9dbc2c4300faa953441a060d46663c92734f (diff)
bugfix for image cleanup and python script calling by subprocess shell
JIRA: BOTTLENECK-70 log is shown in https://build.opnfv.org/ci/view/bottlenecks/job/bottlenecks-compass-vstf-virtual-daily-master/9/console and https://build.opnfv.org/ci/view/bottlenecks/job/bottlenecks-compass-vstf-virtual-daily-master/10/console for image names, we use bottlenecks_<suite name>_<option> for vstf_collector.py, it is used for transfer test result to community dashboard, it works for B release, for C release, we should adapt it later, now we only fix its path error. Change-Id: Iad2bf39837d02aa1e5ea8a323411d98082135882 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'testsuites')
-rwxr-xr-xtestsuites/vstf/run_vstf.py6
-rwxr-xr-xtestsuites/vstf/testcase_cfg/vstf_heat_template.yaml6
-rwxr-xr-xtestsuites/vstf/vstf_collector.py61
3 files changed, 67 insertions, 6 deletions
diff --git a/testsuites/vstf/run_vstf.py b/testsuites/vstf/run_vstf.py
index 319f0055..1aed7596 100755
--- a/testsuites/vstf/run_vstf.py
+++ b/testsuites/vstf/run_vstf.py
@@ -256,9 +256,9 @@ def main():
target_image_created = False
stack_created = False
- manager_image_created = vstf_create_images(imagefile=manager_file, image_name="vstf-manager")
- tester_image_created = vstf_create_images(imagefile=agent_file, image_name="vstf-tester")
- target_image_created = vstf_create_images(imagefile=agent_file, image_name="vstf-target")
+ manager_image_created = vstf_create_images(imagefile=manager_file, image_name="bottlenecks_vstf_manager")
+ tester_image_created = vstf_create_images(imagefile=agent_file, image_name="bottlenecks_vstf_tester")
+ target_image_created = vstf_create_images(imagefile=agent_file, image_name="bottlenecks_vstf_target")
keyPath = Bottlenecks_repo_dir + "/utils/infra_setup/bottlenecks_key/bottlenecks_key.pub"
vstf_create_keypairs(key_path=keyPath)
vstf_create_flavors()
diff --git a/testsuites/vstf/testcase_cfg/vstf_heat_template.yaml b/testsuites/vstf/testcase_cfg/vstf_heat_template.yaml
index a649771f..b69abfd7 100755
--- a/testsuites/vstf/testcase_cfg/vstf_heat_template.yaml
+++ b/testsuites/vstf/testcase_cfg/vstf_heat_template.yaml
@@ -19,15 +19,15 @@ parameters:
image_vstf_manager:
type: string
description: Name of image to use for servers
- default: vstf-manager
+ default: bottlenecks_vstf_manager
image_vstf_tester:
type: string
description: Name of image to use for servers
- default: vstf-tester
+ default: bottlenecks_vstf_tester
image_vstf_target:
type: string
description: Name of image to use for servers
- default: vstf-target
+ default: bottlenecks_vstf_target
#nova flavor-list to query available flavors
flavor:
type: string
diff --git a/testsuites/vstf/vstf_collector.py b/testsuites/vstf/vstf_collector.py
new file mode 100755
index 00000000..7206e32d
--- /dev/null
+++ b/testsuites/vstf/vstf_collector.py
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd. and others
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import os
+import argparse
+import json
+import requests
+import logging
+
+LOG = logging.getLogger(__name__)
+
+class Uploader(object):
+ def __init__(self, conf):
+ self.headers = {'Content-type': 'application/json'}
+ self.timeout = 5
+ self.result = {
+ "project_name": "bottlenecks",
+ "description": "bottlenecks test cases result"}
+
+ with open(conf) as stream:
+ dashboard_conf = json.load(stream)
+ self.result['pod_name'] = dashboard_conf['pod_name']
+ self.result['installer'] = dashboard_conf['installer']
+ self.result['version'] = dashboard_conf['version']
+ self.target = dashboard_conf['target']
+
+ def upload_result(self, case_name, raw_data):
+ if self.target == '':
+ LOG.error('No target was set, so no data will be posted.')
+ return
+ self.result["case_name"] = case_name
+ self.result["details"] = raw_data
+ try:
+ LOG.debug('Result to be uploaded:\n %s' % json.dumps(self.result, indent=4))
+ res = requests.post(self.target,
+ data=json.dumps(self.result),
+ headers=self.headers,
+ timeout=self.timeout)
+ print('Test result posting finished with status code %d.' % res.status_code)
+ except Exception as err:
+ LOG.error('Failed to record result data: %s', err)
+
+
+if __name__ == "__main__":
+ logging.basicConfig(level=logging.DEBUG)
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--config', required=True, help="basic config file for uploader, json format.")
+ parser.add_argument('--dir', required=True, help="result files for test cases")
+ args = parser.parse_args()
+ realpath = os.path.realpath(args.dir)
+ for filename in os.listdir(args.dir):
+ filepath = os.path.join(realpath, filename)
+ LOG.debug("uploading test result from file:%s", filepath)
+ with open(filepath) as stream:
+ result = eval(stream.read())
+ Uploader(args.config).upload_result(filename.lower().replace('-', ''), result)