未验证 提交 ecefbc60 编写于 作者: C Cleber Rosa

Merge remote-tracking branch 'ldoktor/tags-for-remote-runner2'

Signed-off-by: NCleber Rosa <crosa@redhat.com>
......@@ -432,13 +432,28 @@ class RemoteTestRunner(TestRunner):
:param references: a string with test references.
:return: a dictionary with test results.
"""
def arg_to_dest(arg):
"""
Turns long argparse arguments into default dest
"""
return arg[2:].replace('-', '_')
extra_params = []
mux_files = getattr(self.job.args, 'mux_yaml', [])
if mux_files:
extra_params.append("-m %s" % " ".join(mux_files))
# bool or nargs
for arg in ["--mux-yaml", "--dry-run",
"--filter-by-tags-include-empty"]:
value = getattr(self.job.args, arg_to_dest(arg), None)
if value is True:
extra_params.append(arg)
elif value:
extra_params.append("%s %s" % (arg, " ".join(value)))
# append
for arg in ["--filter-by-tags"]:
value = getattr(self.job.args, arg_to_dest(arg), None)
if value:
join = ' %s ' % arg
extra_params.append("%s %s" % (arg, join.join(value)))
if getattr(self.job.args, "dry_run", False):
extra_params.append("--dry-run")
references_str = " ".join(references)
avocado_cmd = ('avocado run --force-job-id %s --json - '
......
......@@ -58,6 +58,8 @@ class RemoteTestRunnerTest(unittest.TestCase):
show_job_log=False,
mux_yaml=['~/avocado/tests/foo.yaml',
'~/avocado/tests/bar/baz.yaml'],
filter_by_tags=["-foo", "-bar"],
filter_by_tags_include_empty=False,
dry_run=True,
env_keep=None,
reference=['/tests/sleeptest.py',
......@@ -98,8 +100,9 @@ class RemoteTestRunnerTest(unittest.TestCase):
cmd_line = ('avocado run --force-job-id '
'0000000000000000000000000000000000000000 --json - '
'--archive /tests/sleeptest.py /tests/other/test '
'passtest.py -m ~/avocado/tests/foo.yaml '
'~/avocado/tests/bar/baz.yaml --dry-run')
'passtest.py --mux-yaml ~/avocado/tests/foo.yaml '
'~/avocado/tests/bar/baz.yaml --dry-run --filter-'
'by-tags -foo --filter-by-tags -bar')
runner.remote.run.assert_called_with(cmd_line,
ignore_status=True,
timeout=61)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册