Merge "Refstack-client should use stestr for tempest testing"

This commit is contained in:
Zuul 2018-09-04 23:20:43 +00:00 committed by Gerrit Code Review
commit bc4b705714
5 changed files with 33 additions and 20 deletions
README.rst
refstack_client
roles/generate-tempestconf-refstack/tasks
setup_env

@ -36,7 +36,7 @@ We've created an "easy button" for Ubuntu, Centos, RHEL and openSUSE.
For example: execute ``./setup_env -t tags/3`` to install Tempest tag-3.
c. By default, Tempest will be installed from commit
cc255bbbf431e114a4fc0ef587cd3d72333f750a (October, 2017).
8316f962c52b01edc5be466b18e54904e2a1248a (Sept, 2018).
Usage
#####
@ -88,9 +88,9 @@ Usage
For example::
refstack-client test -c ~/tempest.conf -v --test-list "https://refstack.openstack.org/api/v1/guidelines/2017.09/tests?target=platform&type=required&alias=true&flag=false"
refstack-client test -c ~/tempest.conf -v --test-list "https://refstack.openstack.org/api/v1/guidelines/2018.02/tests?target=platform&type=required&alias=true&flag=false"
This will run only the test cases required by the 2017.09 guidelines
This will run only the test cases required by the 2018.02 guidelines
that have not been flagged.
**Note:**

@ -41,12 +41,21 @@ class TestListParser(object):
self.insecure = insecure
def _get_tempest_test_ids(self):
"""This does a 'testr list-tests' on the Tempest directory in order to
get a list of full test IDs for the current Tempest environment. Test
ID mappings are then formed for these tests.
"""This does a 'testr list-tests' or 'stestr list' according to
Tempest version on the Tempest directory in order to get a list
of full test IDs for the current Tempest environment. Test ID
mappings are then formed for these tests.
"""
cmd = (os.path.join(self.tempest_dir, 'tools/with_venv.sh'),
'testr', 'list-tests')
if os.path.exists(os.path.join(self.tempest_dir, '.stestr.conf')):
init_cmd = (os.path.join(self.tempest_dir, 'tools/with_venv.sh'),
'stestr', 'init')
subprocess.Popen(init_cmd, stdout=subprocess.PIPE,
cwd=self.tempest_dir)
cmd = (os.path.join(self.tempest_dir, 'tools/with_venv.sh'),
'stestr', 'list')
else:
cmd = (os.path.join(self.tempest_dir, 'tools/with_venv.sh'),
'testr', 'list-tests')
process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
cwd=self.tempest_dir)
(stdout, stderr) = process.communicate()

@ -134,22 +134,26 @@ class RefstackClient:
def _get_next_stream_subunit_output_file(self, tempest_dir):
'''This method reads from the next-stream file in the .testrepository
directory of the given Tempest path. The integer here is the name
of the file where subunit output will be saved to.'''
or .stestr directory according to Tempest version of the given
Tempest path. The integer here is the name of the file where subunit
output will be saved to.'''
if os.path.exists(os.path.join(self.tempest_dir, '.stestr.conf')):
sub_dir = '.stestr'
else:
sub_dir = '.testrepository'
try:
subunit_file = open(os.path.join(
tempest_dir, '.testrepository',
tempest_dir, sub_dir,
'next-stream'), 'r').read().rstrip()
except (IOError, OSError):
self.logger.debug('The .testrepository/next-stream file was not '
self.logger.debug('The ' + sub_dir + '/next-stream file was not '
'found. Assuming subunit results will be stored '
'in file 0.')
# Testr saves the first test stream to .testrepository/0 when
# there is a newly generated .testrepository directory.
# First test stream is saved into $sub_dir/0
subunit_file = "0"
return os.path.join(tempest_dir, '.testrepository', subunit_file)
return os.path.join(tempest_dir, sub_dir, subunit_file)
def _get_keystone_config(self, conf_file):
'''This will get and return the keystone configs from config file.'''
@ -575,7 +579,7 @@ class RefstackClient:
sign_with=self.args.priv_key)
else:
msg1 = ("tempest run command did not generate a results file "
"under the Refstack .tempest/.testrepository "
"under the Refstack os.path.dirname(results_file) "
"directory. Review command and try again.")
msg2 = ("Problem executing tempest run command. Results file "
"not generated hence no file to upload. Review "

@ -3,7 +3,7 @@
shell: |
set -ex
export PATH=$PATH:/usr/local/sbin:/usr/sbin
./setup_env
./setup_env -c master
args:
chdir: "{{ refstack_client_src_relative_path }}"
executable: /bin/bash
@ -39,7 +39,7 @@
source .venv/bin/activate
printenv
refstack-client test -c /tmp/tempest.conf \
-v --test-list "https://refstack.openstack.org/api/v1/guidelines/2017.09/tests?target=platform&type=required&alias=true&flag=false"
-v --test-list "https://refstack.openstack.org/api/v1/guidelines/2018.02/tests?target=platform&type=required&alias=true&flag=false"
args:
chdir: "{{ refstack_client_src_relative_path }}"
executable: /bin/bash

@ -1,7 +1,7 @@
#!/bin/bash -x
#Default Tempest commit: SHA cc255bbbf431e114a4fc0ef587cd3d72333f750a (October 2017)
CHECKOUT_POINT=cc255bbbf431e114a4fc0ef587cd3d72333f750a
#Default Tempest commit: SHA 8316f962c52b01edc5be466b18e54904e2a1248a (Sept 2018)
CHECKOUT_POINT=8316f962c52b01edc5be466b18e54904e2a1248a
PY_VERSION="2.7.8"
# Prints help