Add a unit test for kayobe seed service deploy

This commit is contained in:
Mark Goddard 2018-01-12 18:26:26 +00:00
parent b5eb53f60e
commit 53714fc5a9
2 changed files with 42 additions and 1 deletions

View File

@ -461,7 +461,8 @@ class SeedServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
playbooks = _build_playbook_list("kolla-ansible")
self.run_kayobe_playbooks(parsed_args, playbooks, tags="config")
self.run_kayobe_playbook(parsed_args, "ansible/kolla-bifrost.yml")
playbooks = _build_playbook_list("kolla-bifrost")
self.run_kayobe_playbooks(parsed_args, playbooks)
self.run_kolla_ansible_seed(parsed_args, "deploy-bifrost")
playbooks = _build_playbook_list(
"seed-introspection-rules", "dell-switch-bmp")

View File

@ -387,6 +387,46 @@ class TestCase(unittest.TestCase):
]
self.assertEqual(expected_calls, mock_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_playbooks")
@mock.patch.object(commands.KollaAnsibleMixin,
"run_kolla_ansible_seed")
def test_service_deploy(self, mock_kolla_run, mock_run):
command = commands.SeedServiceDeploy(TestApp(), [])
parser = command.get_parser("test")
parsed_args = parser.parse_args([])
result = command.run(parsed_args)
self.assertEqual(0, result)
expected_calls = [
mock.call(
mock.ANY,
["ansible/kolla-ansible.yml"],
tags="config",
),
mock.call(
mock.ANY,
["ansible/kolla-bifrost.yml"],
),
mock.call(
mock.ANY,
[
"ansible/seed-introspection-rules.yml",
"ansible/dell-switch-bmp.yml",
],
),
]
self.assertEqual(expected_calls, mock_run.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
"deploy-bifrost",
),
]
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_config_dump")
@mock.patch.object(commands.KayobeAnsibleMixin,