Rip out the coverage extension client from tempest
The extension has been removed from nova so there is no reason to keep the tempest side code around. Change-Id: I780028729b71c130a16d23e783f3a12c620b784a
This commit is contained in:
parent
65841cf0a6
commit
96a20bcd90
24
run_tests.sh
24
run_tests.sh
@ -11,7 +11,6 @@ function usage {
|
||||
echo " -u, --update Update the virtual environment with any newer package versions"
|
||||
echo " -s, --smoke Only run smoke tests"
|
||||
echo " -t, --serial Run testr serially"
|
||||
echo " -c, --nova-coverage Enable Nova coverage collection"
|
||||
echo " -C, --config Config file location"
|
||||
echo " -p, --pep8 Just run pep8"
|
||||
echo " -h, --help Print this usage message"
|
||||
@ -31,13 +30,12 @@ never_venv=0
|
||||
no_site_packages=0
|
||||
force=0
|
||||
wrapper=""
|
||||
nova_coverage=0
|
||||
config_file=""
|
||||
update=0
|
||||
logging=0
|
||||
logging_config=etc/logging.conf
|
||||
|
||||
if ! options=$(getopt -o VNnfustcphdC:lL: -l virtual-env,no-virtual-env,no-site-packages,force,update,smoke,serial,nova-coverage,pep8,help,debug,config:,logging,logging-config: -- "$@")
|
||||
if ! options=$(getopt -o VNnfustphdC:lL: -l virtual-env,no-virtual-env,no-site-packages,force,update,smoke,serial,pep8,help,debug,config:,logging,logging-config: -- "$@")
|
||||
then
|
||||
# parse error
|
||||
usage
|
||||
@ -55,7 +53,6 @@ while [ $# -gt 0 ]; do
|
||||
-f|--force) force=1;;
|
||||
-u|--update) update=1;;
|
||||
-d|--debug) set -o xtrace;;
|
||||
-c|--nova-coverage) let nova_coverage=1;;
|
||||
-C|--config) config_file=$2; shift;;
|
||||
-p|--pep8) let just_pep8=1;;
|
||||
-s|--smoke) testrargs+="smoke"; noseargs+="--attr=type=smoke";;
|
||||
@ -131,16 +128,6 @@ function run_pep8 {
|
||||
${wrapper} flake8
|
||||
}
|
||||
|
||||
function run_coverage_start {
|
||||
echo "Starting nova-coverage"
|
||||
${wrapper} python tools/tempest_coverage.py -c start
|
||||
}
|
||||
|
||||
function run_coverage_report {
|
||||
echo "Generating nova-coverage report"
|
||||
${wrapper} python tools/tempest_coverage.py -c report
|
||||
}
|
||||
|
||||
if [ $never_venv -eq 0 ]
|
||||
then
|
||||
# Remove the virtual environment if --force used
|
||||
@ -176,11 +163,6 @@ if [ $just_pep8 -eq 1 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $nova_coverage -eq 1 ]; then
|
||||
run_coverage_start
|
||||
fi
|
||||
|
||||
|
||||
py_version=`${wrapper} python --version 2>&1`
|
||||
if [[ $py_version =~ "2.6" ]] ; then
|
||||
run_tests_nose
|
||||
@ -189,10 +171,6 @@ else
|
||||
fi
|
||||
retval=$?
|
||||
|
||||
if [ $nova_coverage -eq 1 ]; then
|
||||
run_coverage_report
|
||||
fi
|
||||
|
||||
if [ -z "$testrargs" ]; then
|
||||
run_pep8
|
||||
fi
|
||||
|
@ -1,193 +0,0 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2012 IBM Corp.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from tempest.common.rest_client import RestClient
|
||||
from tempest import config
|
||||
|
||||
CONF = config.TempestConfig()
|
||||
|
||||
|
||||
class CoverageClientJSON(RestClient):
|
||||
|
||||
def __init__(self, config, username, password, auth_url, tenant_name=None):
|
||||
super(CoverageClientJSON, self).__init__(config, username, password,
|
||||
auth_url, tenant_name)
|
||||
self.service = self.config.compute.catalog_type
|
||||
|
||||
def start_coverage(self):
|
||||
post_body = {
|
||||
'start': {},
|
||||
}
|
||||
post_body = json.dumps(post_body)
|
||||
return self.post('os-coverage/action', post_body, self.headers)
|
||||
|
||||
def start_coverage_combine(self):
|
||||
post_body = {
|
||||
'start': {
|
||||
'combine': True,
|
||||
},
|
||||
}
|
||||
post_body = json.dumps(post_body)
|
||||
return self.post('os-coverage/action', post_body, self.headers)
|
||||
|
||||
def stop_coverage(self):
|
||||
post_body = {
|
||||
'stop': {},
|
||||
}
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('os-coverage/action', post_body, self.headers)
|
||||
body = json.loads(body)
|
||||
return resp, body
|
||||
|
||||
def report_coverage_xml(self, file=None):
|
||||
post_body = {
|
||||
'report': {
|
||||
'file': 'coverage.report',
|
||||
'xml': True,
|
||||
},
|
||||
}
|
||||
if file:
|
||||
post_body['report']['file'] = file
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('os-coverage/action', post_body, self.headers)
|
||||
body = json.loads(body)
|
||||
return resp, body
|
||||
|
||||
def report_coverage(self, file=None):
|
||||
post_body = {
|
||||
'report': {
|
||||
'file': 'coverage.report',
|
||||
},
|
||||
}
|
||||
if file:
|
||||
post_body['report']['file'] = file
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('os-coverage/action', post_body, self.headers)
|
||||
body = json.loads(body)
|
||||
return resp, body
|
||||
|
||||
def report_coverage_html(self, file=None):
|
||||
post_body = {
|
||||
'report': {
|
||||
'file': 'coverage.report',
|
||||
'html': True,
|
||||
},
|
||||
}
|
||||
if file:
|
||||
post_body['report']['file'] = file
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('os-coverage/action', post_body, self.headers)
|
||||
body = json.loads(body)
|
||||
return resp, body
|
||||
|
||||
|
||||
def parse_opts(argv):
|
||||
cli_opts = [
|
||||
cfg.StrOpt('command',
|
||||
short='c',
|
||||
default='',
|
||||
help="This required argument is used to specify the "
|
||||
"coverage command to run. Only 'start', "
|
||||
"'stop', or 'report' are valid fields."),
|
||||
cfg.StrOpt('filename',
|
||||
default='tempest-coverage',
|
||||
help="Specify a filename to be used for generated report "
|
||||
"files"),
|
||||
cfg.BoolOpt('xml',
|
||||
default=False,
|
||||
help='Generate XML reports instead of text'),
|
||||
cfg.BoolOpt('html',
|
||||
default=False,
|
||||
help='Generate HTML reports instead of text'),
|
||||
cfg.BoolOpt('combine',
|
||||
default=False,
|
||||
help='Generate a single report for all services'),
|
||||
cfg.StrOpt('output',
|
||||
short='o',
|
||||
default=None,
|
||||
help='Optional directory to copy generated coverage data or'
|
||||
' reports into. This directory must not already exist '
|
||||
'it will be created')
|
||||
]
|
||||
CLI = cfg.ConfigOpts()
|
||||
CLI.register_cli_opts(cli_opts)
|
||||
CLI(argv[1:])
|
||||
return CLI
|
||||
|
||||
|
||||
def main(argv):
|
||||
CLI = parse_opts(argv)
|
||||
client_args = (CONF, CONF.identity.admin_username,
|
||||
CONF.identity.admin_password, CONF.identity.uri,
|
||||
CONF.identity.admin_tenant_name)
|
||||
coverage_client = CoverageClientJSON(*client_args)
|
||||
|
||||
if CLI.command == 'start':
|
||||
if CLI.combine:
|
||||
coverage_client.start_coverage_combine()
|
||||
else:
|
||||
coverage_client.start_coverage()
|
||||
|
||||
elif CLI.command == 'stop':
|
||||
resp, body = coverage_client.stop_coverage()
|
||||
if not resp['status'] == '200':
|
||||
print('coverage stop failed with: %s:' % (resp['status'] + ': '
|
||||
+ body))
|
||||
exit(int(resp['status']))
|
||||
path = body['path']
|
||||
if CLI.output:
|
||||
shutil.copytree(path, CLI.output)
|
||||
else:
|
||||
print("Data files located at: %s" % path)
|
||||
|
||||
elif CLI.command == 'report':
|
||||
if CLI.xml:
|
||||
resp, body = coverage_client.report_coverage_xml(file=CLI.filename)
|
||||
elif CLI.html:
|
||||
resp, body = coverage_client.report_coverage_html(
|
||||
file=CLI.filename)
|
||||
else:
|
||||
resp, body = coverage_client.report_coverage(file=CLI.filename)
|
||||
if not resp['status'] == '200':
|
||||
print('coverage report failed with: %s:' % (resp['status'] + ': '
|
||||
+ body))
|
||||
exit(int(resp['status']))
|
||||
path = body['path']
|
||||
if CLI.output:
|
||||
if CLI.html:
|
||||
shutil.copytree(path, CLI.output)
|
||||
else:
|
||||
path = os.path.dirname(path)
|
||||
shutil.copytree(path, CLI.output)
|
||||
else:
|
||||
if not CLI.html:
|
||||
path = os.path.dirname(path)
|
||||
print('Report files located at: %s' % path)
|
||||
|
||||
else:
|
||||
print('Invalid command')
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
7
tox.ini
7
tox.ini
@ -88,13 +88,6 @@ sitepackages = True
|
||||
commands =
|
||||
sh tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])((smoke)|(^tempest\.scenario)) {posargs}'
|
||||
|
||||
[testenv:coverage]
|
||||
sitepackages = True
|
||||
commands =
|
||||
python -m tools/tempest_coverage -c start --combine
|
||||
sh tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty|cli))'
|
||||
python -m tools/tempest_coverage -c report --html {posargs}
|
||||
|
||||
[testenv:stress]
|
||||
sitepackages = True
|
||||
commands =
|
||||
|
Loading…
Reference in New Issue
Block a user