Skip to content

Commit

Permalink
add test for ansible playbook bin path
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFieryLynx committed Mar 14, 2024
1 parent b1dae5c commit bbb9f20
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/cotea_internal_error_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ def tearDown(self) -> None:
# to clear previous execution context
remove_modules_from_imported(module_name_like="cotea")

def test_incorrect_playbook_bin_path(self):
from cotea.runner import runner
from cotea.arguments_maker import argument_maker

pb_path = "cotea_run_files/ok.yaml"
inv_path = "cotea_run_files/inv"
ansible_pb_bin = "/path/to/.venv/bin/ansible-playbook"

arg_maker = argument_maker()
arg_maker.add_arg("-i", inv_path)

try:
runner(pb_path, arg_maker, show_progress_bar=True, ansible_pb_bin=ansible_pb_bin)
except Exception as e:
self.assertTrue(str(e) == f"Ansible playbook bin {ansible_pb_bin} not found",
msg="Unexpected exception message")
else:
self.assertFalse(True, msg="Ansible is supposed to fail due to incorrect ansible playbook bin path")

def test_incorrect_playbook_path_case(self):
from cotea.runner import runner
from cotea.arguments_maker import argument_maker
Expand Down

0 comments on commit bbb9f20

Please sign in to comment.