[Verify] Discover tests for system-wide Tempest installation
This patch allows us to discover tests for system-wide Tempest installation. Change-Id: Icc7272f1589dcf2656f3d970859b590da64061ab
This commit is contained in:
parent
01faa04852
commit
72a4f74529
@ -48,7 +48,7 @@ _rally()
|
|||||||
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
|
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
|
||||||
OPTS["verify_compare"]="--uuid-1 --uuid-2 --csv --html --json --output-file --threshold"
|
OPTS["verify_compare"]="--uuid-1 --uuid-2 --csv --html --json --output-file --threshold"
|
||||||
OPTS["verify_detailed"]="--uuid --sort-by"
|
OPTS["verify_detailed"]="--uuid --sort-by"
|
||||||
OPTS["verify_discover"]="--deployment --pattern"
|
OPTS["verify_discover"]="--deployment --pattern --system-wide"
|
||||||
OPTS["verify_genconfig"]="--deployment --tempest-config --override"
|
OPTS["verify_genconfig"]="--deployment --tempest-config --override"
|
||||||
OPTS["verify_import"]="--deployment --set --file --no-use"
|
OPTS["verify_import"]="--deployment --set --file --no-use"
|
||||||
OPTS["verify_install"]="--deployment --source --version --system-wide"
|
OPTS["verify_install"]="--deployment --source --version --system-wide"
|
||||||
|
@ -541,14 +541,16 @@ class Verification(object):
|
|||||||
verifier.uninstall_plugin(repo_name)
|
verifier.uninstall_plugin(repo_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def discover_tests(cls, deployment, pattern=""):
|
def discover_tests(cls, deployment, pattern="", system_wide=False):
|
||||||
"""Get a list of discovered tests.
|
"""Get a list of discovered tests.
|
||||||
|
|
||||||
:param deployment: UUID or name of a deployment
|
:param deployment: UUID or name of a deployment
|
||||||
:param pattern: Test name pattern which can be used to match
|
:param pattern: Test name pattern which can be used to match
|
||||||
|
:param system_wide: Discover tests for system-wide or venv
|
||||||
|
Tempest installation
|
||||||
"""
|
"""
|
||||||
deployment_uuid = objects.Deployment.get(deployment)["uuid"]
|
deployment_uuid = objects.Deployment.get(deployment)["uuid"]
|
||||||
verifier = tempest.Tempest(deployment_uuid)
|
verifier = tempest.Tempest(deployment_uuid, system_wide=system_wide)
|
||||||
|
|
||||||
cls._check_tempest_tree_existence(verifier)
|
cls._check_tempest_tree_existence(verifier)
|
||||||
|
|
||||||
|
@ -546,14 +546,20 @@ class VerifyCommands(object):
|
|||||||
@cliutils.args("--pattern", dest="pattern", type=str,
|
@cliutils.args("--pattern", dest="pattern", type=str,
|
||||||
required=False, metavar="<pattern>",
|
required=False, metavar="<pattern>",
|
||||||
help="Test name pattern which can be used to match")
|
help="Test name pattern which can be used to match")
|
||||||
|
@cliutils.args("--system-wide", dest="system_wide",
|
||||||
|
help="Discover tests for system-wide Tempest installation",
|
||||||
|
required=False, action="store_true")
|
||||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||||
def discover(self, deployment=None, pattern=""):
|
def discover(self, deployment=None, pattern="", system_wide=False):
|
||||||
"""Show a list of discovered tests.
|
"""Show a list of discovered tests.
|
||||||
|
|
||||||
:param deployment: UUID or name of a deployment
|
:param deployment: UUID or name of a deployment
|
||||||
:param pattern: Test name pattern which can be used to match
|
:param pattern: Test name pattern which can be used to match
|
||||||
|
:param system_wide: Discover tests for system-wide or venv
|
||||||
|
Tempest installation
|
||||||
"""
|
"""
|
||||||
discovered_tests = api.Verification.discover_tests(deployment, pattern)
|
discovered_tests = api.Verification.discover_tests(deployment, pattern,
|
||||||
|
system_wide)
|
||||||
p_str = (_(" matching pattern '%s'") % pattern) if pattern else ""
|
p_str = (_(" matching pattern '%s'") % pattern) if pattern else ""
|
||||||
if discovered_tests:
|
if discovered_tests:
|
||||||
print(_("Discovered tests%s:\n") % p_str)
|
print(_("Discovered tests%s:\n") % p_str)
|
||||||
@ -567,7 +573,7 @@ class VerifyCommands(object):
|
|||||||
help="UUID or name of a deployment.")
|
help="UUID or name of a deployment.")
|
||||||
@envutils.with_default_deployment(cli_arg_name="deployment")
|
@envutils.with_default_deployment(cli_arg_name="deployment")
|
||||||
def showconfig(self, deployment=None):
|
def showconfig(self, deployment=None):
|
||||||
"""Show configuration file of Tempest.
|
"""Show Tempest configuration file.
|
||||||
|
|
||||||
:param deployment: UUID or name of a deployment
|
:param deployment: UUID or name of a deployment
|
||||||
"""
|
"""
|
||||||
|
@ -416,7 +416,9 @@ class Tempest(object):
|
|||||||
|
|
||||||
:param pattern: Test name pattern which can be used to match
|
:param pattern: Test name pattern which can be used to match
|
||||||
"""
|
"""
|
||||||
cmd = [self.venv_wrapper, "testr", "list-tests", pattern]
|
cmd = ["testr", "list-tests", pattern]
|
||||||
|
if not self._system_wide:
|
||||||
|
cmd.insert(0, self.path("tools/with_venv.sh"))
|
||||||
raw_results = subprocess.Popen(
|
raw_results = subprocess.Popen(
|
||||||
cmd, cwd=self.path(), env=self.env,
|
cmd, cwd=self.path(), env=self.env,
|
||||||
stdout=subprocess.PIPE).communicate()[0]
|
stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
@ -567,7 +567,7 @@ class VerifyCommandsTestCase(test.TestCase):
|
|||||||
deployment_uuid = "97725f22-1cd2-46a5-8c62-3cdc36ed6d2a"
|
deployment_uuid = "97725f22-1cd2-46a5-8c62-3cdc36ed6d2a"
|
||||||
self.verify.discover(deployment_uuid, "some_pattern")
|
self.verify.discover(deployment_uuid, "some_pattern")
|
||||||
mock_verification_discover_tests.assert_called_once_with(
|
mock_verification_discover_tests.assert_called_once_with(
|
||||||
deployment_uuid, "some_pattern")
|
deployment_uuid, "some_pattern", False)
|
||||||
|
|
||||||
@mock.patch("rally.api.Verification.show_config_info")
|
@mock.patch("rally.api.Verification.show_config_info")
|
||||||
def test_showconfig(self, mock_verification_show_config_info):
|
def test_showconfig(self, mock_verification_show_config_info):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user