Add argument for specifying test-list directly

Because test attributes can constantly change in test lists, refstack-client
should have a native argument for passing in test lists (instead of '-- --load-list')
Refstack-client will normalize the tests in the given list by matching it to
test IDs in the current Tempest environment.

Closes-Bug: #1475407
Change-Id: I1e3f026f5cd706cf73b6febfce98cb96b742d4d6
This commit is contained in:
Paul Van Eck
2015-07-17 10:13:08 -07:00
parent 29c9ecea66
commit 43777f9820
7 changed files with 486 additions and 33 deletions

View File

@@ -26,6 +26,7 @@ import unittest
import refstack_client.refstack_client as rc
import refstack_client.list_parser as lp
class TestRefstackClient(unittest.TestCase):
@@ -381,6 +382,33 @@ class TestRefstackClient(unittest.TestCase):
sign_with='rsa_key'
)
def test_run_tempest_with_test_list(self):
"""Test that the Tempest script runs with a test list file."""
argv = self.mock_argv(verbose='-vv')
argv.extend(['--test-list', 'test-list.txt'])
args = rc.parse_cli_args(argv)
client = rc.RefstackClient(args)
client.tempest_dir = self.test_path
mock_popen = self.patch(
'refstack_client.refstack_client.subprocess.Popen',
return_value=MagicMock(returncode=0))
self.patch("os.path.isfile", return_value=True)
self.mock_keystone()
client.get_passed_tests = MagicMock(return_value=[{'name': 'test'}])
client._save_json_results = MagicMock()
client.post_results = MagicMock()
lp.TestListParser.get_normalized_test_list = MagicMock(
return_value="/tmp/some-list")
client.test()
lp.TestListParser.get_normalized_test_list.assert_called_with(
'test-list.txt')
mock_popen.assert_called_with(
['%s/run_tempest.sh' % self.test_path, '-C', self.conf_file_name,
'-V', '-t', '--', '--load-list', '/tmp/some-list'],
stderr=None
)
def test_run_tempest_no_conf_file(self):
"""
Test when a nonexistent configuration file is passed in.