Refstack-client should use stestr for tempest testing

Tempest has changed to use stestr instead of testr and testrepository
starting from 18.0.0,and the testr.conf was removed:
https://review.openstack.org/#/c/504345/

refstack-client will not able to run for tempest 18.0.0 as some commands
need the testr.conf in the path:

root@defcore:/home/defcore/refstack-client/refstack_client#
/home/defcore/refstack-client/.tempest/tools/with_venv.sh testr
list-tests
No .testr.conf config file

Tempest Commit SHA: 8316f962c52b01edc5be466b18e54904e2a1248a pointing
to tempest 19.0.0

Install tempest from master

Updated Guidelines to match 2018.02

Change-Id: Ic796cc7ad48037e64a4437d4834051c7fa7cbda1
Closes-Bug: #1765609
This commit is contained in:
Chandan Kumar 2018-08-16 17:25:51 +05:30
parent e1744ea1e4
commit 74b6ac1c3f
5 changed files with 33 additions and 20 deletions

View File

@ -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:**

View File

@ -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()

View File

@ -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 "

View File

@ -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

View File

@ -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