Merge "refstack-client default verbosity should be info."
This commit is contained in:
commit
0d9423ebc3
23
README.rst
23
README.rst
@ -40,45 +40,44 @@ We've created an "easy button" for Ubuntu, Centos, RHEL and openSuSe.
|
||||
|
||||
4. Validate your setup by running a short test.
|
||||
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -vv -- tempest.api.identity.admin.v2.test_roles`
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -v -- tempest.api.identity.admin.v2.test_roles`
|
||||
|
||||
or
|
||||
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -vv -- tempest.api.identity.v2.test_token`
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -v -- tempest.api.identity.v2.test_token`
|
||||
|
||||
|
||||
5. Run tests.
|
||||
|
||||
To run the entire API test set:
|
||||
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -vv`
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -v`
|
||||
|
||||
To run only those tests specified in a DefCore defined test file:
|
||||
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -vv --test-list <Path or URL of test list>`
|
||||
`./refstack-client test -c <Path of the tempest configuration file to use> -v --test-list <Path or URL of test list>`
|
||||
|
||||
For example:
|
||||
|
||||
`./refstack-client test -c ~/tempest.conf -vv --test-list https://raw.githubusercontent.com/openstack/defcore/master/2015.05/2015.05.required.txt`
|
||||
`./refstack-client test -c ~/tempest.conf -v --test-list https://raw.githubusercontent.com/openstack/defcore/master/2015.05/2015.05.required.txt`
|
||||
|
||||
This will run only the test cases listed in 2015.05.required.txt.
|
||||
|
||||
**Note:**
|
||||
|
||||
a. Adding the `-v` option will show the summary output.
|
||||
b. Adding the `-vv` option will show the Tempest test result output.
|
||||
c. Adding the `--upload` option will have your test results be uploaded to the
|
||||
a. Adding the `-v` option will show the Tempest test result output.
|
||||
b. Adding the `--upload` option will have your test results be uploaded to the
|
||||
default RefStack API server or the server specified by `--url`.
|
||||
d. Adding the `--test-list` option will allow you to specify the file path or URL of
|
||||
c. Adding the `--test-list` option will allow you to specify the file path or URL of
|
||||
a test list text file. This test list should contain specific test cases that
|
||||
should be tested. Tests lists passed in using this argument will be normalized
|
||||
with the current Tempest evironment to eliminate any attribute mismatches.
|
||||
e. Adding the `--url` option will allow you to change where test results should
|
||||
d. Adding the `--url` option will allow you to change where test results should
|
||||
be uploaded.
|
||||
f. Adding the `-r` option with a string will prefix the JSON result file with the
|
||||
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').
|
||||
g. Adding `--` enables you to pass arbitary arguments to the Tempest runner.
|
||||
f. Adding `--` enables you to pass arbitary arguments to the Tempest runner.
|
||||
After the first `--`, all other subsequent arguments will be passed to
|
||||
the Tempest runner as is. This is mainly used for quick verification of the
|
||||
target test cases. (e.g. `-- tempest.api.identity.v2.test_token`)
|
||||
|
@ -75,12 +75,13 @@ class RefstackClient:
|
||||
self.args = args
|
||||
self.tempest_dir = '.tempest'
|
||||
|
||||
if self.args.verbose > 1:
|
||||
# set default log level to INFO.
|
||||
if self.args.silent:
|
||||
self.logger.setLevel(logging.WARNING)
|
||||
elif self.args.verbose > 0:
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
elif self.args.verbose == 1:
|
||||
self.logger.setLevel(logging.INFO)
|
||||
else:
|
||||
self.logger.setLevel(logging.ERROR)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
|
||||
def _prep_test(self):
|
||||
'''Prepare a tempest test against a cloud.'''
|
||||
@ -317,7 +318,7 @@ class RefstackClient:
|
||||
cmd += ['--', "tempest.api"]
|
||||
|
||||
# If there were two verbose flags, show tempest results.
|
||||
if self.args.verbose > 1:
|
||||
if self.args.verbose > 0:
|
||||
stderr = None
|
||||
else:
|
||||
# Suppress tempest results output. Note that testr prints
|
||||
@ -456,10 +457,14 @@ def parse_cli_args(args=None):
|
||||
|
||||
# Arguments that go with all subcommands.
|
||||
shared_args = argparse.ArgumentParser(add_help=False)
|
||||
group = shared_args.add_mutually_exclusive_group()
|
||||
group.add_argument('-s', '--silent',
|
||||
action='store_true',
|
||||
help='Suppress output except warnings and errors.')
|
||||
|
||||
shared_args.add_argument('-v', '--verbose',
|
||||
action='count',
|
||||
help='Show verbose output.')
|
||||
group.add_argument('-v', '--verbose',
|
||||
action='count',
|
||||
help='Show verbose output.')
|
||||
|
||||
shared_args.add_argument('-y',
|
||||
action='store_true',
|
||||
|
@ -55,6 +55,8 @@ class TestRefstackClient(unittest.TestCase):
|
||||
argv = [command]
|
||||
if kwargs.get('verbose', None):
|
||||
argv.append(kwargs.get('verbose', None))
|
||||
if kwargs.get('silent', None):
|
||||
argv.append(kwargs.get('silent', None))
|
||||
argv.extend(['--url', 'http://127.0.0.1', '-y'])
|
||||
if kwargs.get('priv_key', None):
|
||||
argv.extend(('-i', kwargs.get('priv_key', None)))
|
||||
@ -63,7 +65,6 @@ class TestRefstackClient(unittest.TestCase):
|
||||
('-c', kwargs.get('conf_file_name', self.conf_file_name)))
|
||||
if kwargs.get('test_cases', None):
|
||||
argv.extend(('--', kwargs.get('test_cases', None)))
|
||||
|
||||
return argv
|
||||
|
||||
def mock_keystone(self):
|
||||
@ -107,13 +108,13 @@ class TestRefstackClient(unittest.TestCase):
|
||||
client = rc.RefstackClient(args)
|
||||
client.tempest_dir = self.test_path
|
||||
client._prep_test()
|
||||
self.assertEqual(client.logger.level, logging.ERROR)
|
||||
self.assertEqual(client.logger.level, logging.INFO)
|
||||
|
||||
args = rc.parse_cli_args(self.mock_argv(verbose='-v'))
|
||||
client = rc.RefstackClient(args)
|
||||
client.tempest_dir = self.test_path
|
||||
client._prep_test()
|
||||
self.assertEqual(client.logger.level, logging.INFO)
|
||||
self.assertEqual(client.logger.level, logging.DEBUG)
|
||||
|
||||
args = rc.parse_cli_args(self.mock_argv(verbose='-vv'))
|
||||
client = rc.RefstackClient(args)
|
||||
@ -121,6 +122,19 @@ class TestRefstackClient(unittest.TestCase):
|
||||
client._prep_test()
|
||||
self.assertEqual(client.logger.level, logging.DEBUG)
|
||||
|
||||
args = rc.parse_cli_args(self.mock_argv(silent='-s'))
|
||||
client = rc.RefstackClient(args)
|
||||
client.tempest_dir = self.test_path
|
||||
client._prep_test()
|
||||
self.assertEqual(client.logger.level, logging.WARNING)
|
||||
|
||||
args = rc.parse_cli_args(self.mock_argv(silent='-s'))
|
||||
args = rc.parse_cli_args(self.mock_argv(verbose='-v'))
|
||||
client = rc.RefstackClient(args)
|
||||
client.tempest_dir = self.test_path
|
||||
client._prep_test()
|
||||
self.assertRaises(SystemExit, client.__init__(args))
|
||||
|
||||
def test_get_next_stream_subunit_output_file(self):
|
||||
"""
|
||||
Test getting the subunit file from an existing .testrepository
|
||||
|
Loading…
Reference in New Issue
Block a user