Replace ostestr with tempest run
ostestr has been removed, and is being replace with the `tempest run` command for now. Change-Id: Ie6b13ed3967f31248aea0cbeb9cde75a02b690f8
This commit is contained in:
parent
4e187b0767
commit
ae949741ad
17
README.rst
17
README.rst
@ -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
|
||||
19e20abb9311dc3c786d32418966185085af6a3e (July 10, 2017 tags 16.1.0).
|
||||
cc255bbbf431e114a4fc0ef587cd3d72333f750a (October, 2017).
|
||||
|
||||
Usage
|
||||
#####
|
||||
@ -68,14 +68,13 @@ Usage
|
||||
|
||||
To run only those tests specified in an OpenStack Powered (TM) Guideline::
|
||||
|
||||
refstack-client test -c <Path of the tempest configuration file to use> -v --test-list <Path or URL of test list>
|
||||
refstack-client test -c <Path of the tempest configuration file to use> -v -–test-list <Absolute path of test list>
|
||||
|
||||
For example::
|
||||
|
||||
refstack-client test -c ~/tempest.conf -v --test-list \
|
||||
"https://refstack.openstack.org/api/v1/guidelines/2017.01/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/2017.09/tests?target=platform&type=required&alias=true&flag=false"
|
||||
|
||||
This will run only the test cases required by the 2017.01 guidelines
|
||||
This will run only the test cases required by the 2017.09 guidelines
|
||||
that have not been flagged.
|
||||
|
||||
**Note:**
|
||||
@ -92,9 +91,9 @@ Usage
|
||||
e. Adding the ``-r`` option with a string will prefix the JSON result file with the
|
||||
given string (e.g. ``-r my-test`` will yield a result file like
|
||||
'my-test-0.json').
|
||||
f. Adding ``--`` enables you to pass arbitrary arguments to the ostestr runner.
|
||||
f. Adding ``--`` enables you to pass arbitrary arguments to tempest run.
|
||||
After the first ``--``, all other subsequent arguments will be passed to
|
||||
the ostestr runner as is. This is mainly used for quick verification of the
|
||||
tempest run as is. This is mainly used for quick verification of the
|
||||
target test cases. (e.g. ``-- --regex tempest.api.identity.v2.test_token``)
|
||||
|
||||
Use ``refstack-client test --help`` for the full list of arguments.
|
||||
@ -158,7 +157,7 @@ switching to that directory and using the installed dependencies.
|
||||
|
||||
1. ``cd .tempest``
|
||||
2. ``source ./.venv/bin/activate``
|
||||
and run tests manually with ``ostestr``.
|
||||
and run tests manually with ``tempest run``.
|
||||
|
||||
This will make the entire Tempest environment available for you to run,
|
||||
including the ``ostestr`` and ``testr`` commands.
|
||||
including ``tempest run``.
|
||||
|
@ -424,11 +424,11 @@ class RefstackClient:
|
||||
self.logger.info("Starting Tempest test...")
|
||||
start_time = time.time()
|
||||
|
||||
# Run the ostestr command, conf file specified at _prep_test method
|
||||
# Run the tempest run command, conf file specified at _prep_test method
|
||||
# Use virtual environment (wrapper script)
|
||||
# telling it to run the tests serially (--serial).
|
||||
wrapper = os.path.join(self.tempest_dir, 'tools', 'with_venv.sh')
|
||||
cmd = [wrapper, 'ostestr', '--serial', '--no-slowest']
|
||||
cmd = [wrapper, 'tempest', 'run', '--serial']
|
||||
# If a test list was specified, have it take precedence.
|
||||
if self.args.test_list:
|
||||
self.logger.info("Normalizing test list...")
|
||||
@ -449,7 +449,7 @@ class RefstackClient:
|
||||
self.logger.error("Error normalizing passed in test list.")
|
||||
exit(1)
|
||||
elif 'arbitrary_args' in self.args:
|
||||
# Additional arguments for ostestr runner
|
||||
# Additional arguments for tempest run
|
||||
# otherwise run all Tempest API tests.
|
||||
# keep usage(-- testCaseName)
|
||||
tmp = self.args.arbitrary_args[1:]
|
||||
@ -466,14 +466,14 @@ class RefstackClient:
|
||||
# results to stderr.
|
||||
stderr = open(os.devnull, 'w')
|
||||
|
||||
# Execute the ostestr command in a subprocess.
|
||||
# Execute the tempest run command in a subprocess.
|
||||
os.chdir(self.tempest_dir)
|
||||
process = subprocess.Popen(cmd, stderr=stderr)
|
||||
process.communicate()
|
||||
os.chdir(self.refstack_dir)
|
||||
|
||||
# If the subunit file was created, then test cases were executed via
|
||||
# ostestr and there is test output to process.
|
||||
# tempest run and there is test output to process.
|
||||
if os.path.isfile(results_file):
|
||||
end_time = time.time()
|
||||
elapsed = end_time - start_time
|
||||
@ -503,12 +503,12 @@ class RefstackClient:
|
||||
self.post_results(self.args.url, content,
|
||||
sign_with=self.args.priv_key)
|
||||
else:
|
||||
msg1 = ("ostestr command did not generate a results file under "
|
||||
"the Refstack .tempest/.testrepository directory."
|
||||
"Review command and try again.")
|
||||
msg2 = ("Problem executing ostestr command. Results file not "
|
||||
"generated hence no file to upload. "
|
||||
"Review arbitrary arguments.")
|
||||
msg1 = ("tempest run command did not generate a results file "
|
||||
"under the Refstack .tempest/.testrepository "
|
||||
"directory. Review command and try again.")
|
||||
msg2 = ("Problem executing tempest run command. Results file "
|
||||
"not generated hence no file to upload. Review "
|
||||
"arbitrary arguments.")
|
||||
if process.returncode != 0:
|
||||
self.logger.warning(msg1)
|
||||
if self.args.upload:
|
||||
@ -752,10 +752,11 @@ def parse_cli_args(args=None):
|
||||
parser_test.add_argument('arbitrary_args',
|
||||
nargs=argparse.REMAINDER,
|
||||
help='After the first "--", you can pass '
|
||||
'arbitrary arguments to the ostestr runner. '
|
||||
'This can be used for running specific test '
|
||||
'cases or test lists. Some examples are: '
|
||||
'-- --regex tempest.api.compute.images.'
|
||||
'arbitrary arguments to the tempest run '
|
||||
'runner. This can be used for running '
|
||||
'specific test cases or test lists. '
|
||||
'Some examples are: -- --regex '
|
||||
'tempest.api.compute.images.'
|
||||
'test_list_image_filters OR '
|
||||
'-- --whitelist_file /tmp/testid-list.txt')
|
||||
parser_test.set_defaults(func="test")
|
||||
|
@ -570,8 +570,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
client.test()
|
||||
|
||||
mock_popen.assert_called_with(
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'ostestr',
|
||||
'--serial', '--no-slowest', '--regex', 'tempest.api.compute'],
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'tempest', 'run',
|
||||
'--serial', '--regex', 'tempest.api.compute'],
|
||||
stderr=None
|
||||
)
|
||||
|
||||
@ -601,8 +601,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
client._get_cpid_from_keystone = MagicMock()
|
||||
client.test()
|
||||
mock_popen.assert_called_with(
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'ostestr',
|
||||
'--serial', '--no-slowest', '--regex', 'tempest.api.compute'],
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'tempest', 'run',
|
||||
'--serial', '--regex', 'tempest.api.compute'],
|
||||
stderr=None
|
||||
)
|
||||
|
||||
@ -634,8 +634,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
return_value='test-id')
|
||||
client.test()
|
||||
mock_popen.assert_called_with(
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'ostestr',
|
||||
'--serial', '--no-slowest', '--regex', 'tempest.api.compute'],
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'tempest', 'run',
|
||||
'--serial', '--regex', 'tempest.api.compute'],
|
||||
stderr=None
|
||||
)
|
||||
|
||||
@ -675,8 +675,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
|
||||
mock_whitelist.assert_called_with('test-list.txt')
|
||||
mock_popen.assert_called_with(
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'ostestr', '--serial',
|
||||
'--no-slowest', '--whitelist_file', '/tmp/some-list'],
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'tempest', 'run',
|
||||
'--serial', '--whitelist_file', '/tmp/some-list'],
|
||||
stderr=None
|
||||
)
|
||||
|
||||
@ -735,8 +735,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
client.test()
|
||||
|
||||
mock_popen.assert_called_with(
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'ostestr',
|
||||
'--serial', '--no-slowest', '--regex', 'tempest.api.compute'],
|
||||
['%s/tools/with_venv.sh' % self.test_path, 'tempest', 'run',
|
||||
'--serial', '--regex', 'tempest.api.compute'],
|
||||
stderr=None
|
||||
)
|
||||
# Since '1' is in the next-stream file, we expect the JSON output file
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
#Default Tempest commit: SHA 19e20abb9311dc3c786d32418966185085af6a3e (July 10, 2017 tags 16.1.0)
|
||||
CHECKOUT_POINT=19e20abb9311dc3c786d32418966185085af6a3e
|
||||
#Default Tempest commit: SHA cc255bbbf431e114a4fc0ef587cd3d72333f750a (October 2017)
|
||||
CHECKOUT_POINT=cc255bbbf431e114a4fc0ef587cd3d72333f750a
|
||||
PY_VERSION="2.7.8"
|
||||
|
||||
# Prints help
|
||||
@ -165,7 +165,7 @@ cd ..
|
||||
rm -rf virtualenv-${VENV_VERSION}
|
||||
rm virtualenv-${VENV_VERSION}.tar.gz
|
||||
${WORKDIR}/.venv/bin/python -m pip install -e .
|
||||
${TEMPEST_DIR}/.venv/bin/python -m pip install -r ${TEMPEST_DIR}/requirements.txt
|
||||
${TEMPEST_DIR}/.venv/bin/python -m pip install ${TEMPEST_DIR}
|
||||
|
||||
# Add additional packages to find more tests by tempest
|
||||
# Note: Since there are no requirements in tempest-additional-requirements.txt by default,
|
||||
|
Loading…
x
Reference in New Issue
Block a user