diff --git a/tests/test_cli/deploy/deploy.py b/tests/test_cli/deploy/deploy.py index a4b008483..221e2e933 100644 --- a/tests/test_cli/deploy/deploy.py +++ b/tests/test_cli/deploy/deploy.py @@ -79,3 +79,9 @@ def my_deploy(): dest="/a_template", is_template=True, ) + +with host.when(lambda: host.name != "somehost"): + server.shell( + name="Second final limited operation", + commands="echo final_limited_op", + ) diff --git a/tests/test_cli/test_cli_deploy.py b/tests/test_cli/test_cli_deploy.py index eeeb1355a..b30d377af 100644 --- a/tests/test_cli/test_cli_deploy.py +++ b/tests/test_cli/test_cli_deploy.py @@ -33,10 +33,14 @@ def _assert_op_data(self, correct_op_name_and_host_names): assert list(op_meta.names)[0] == correct_op_name for host in state.inventory: + executed = False + host_op = state.ops[host].get(op_hash) + if host_op: + executed = host_op.operation_meta.executed if correct_host_names is True or host.name in correct_host_names: - self.assertIn(op_hash, host.op_hash_order) + assert executed is True else: - self.assertNotIn(op_hash, host.op_hash_order) + assert executed is False def test_deploy(self): task_file_path = path.join("tasks", "a_task.py") @@ -72,6 +76,7 @@ def test_deploy(self): ("Nested order loop 2/1", ("somehost", "anotherhost")), ("Nested order loop 2/2", ("somehost", "anotherhost")), ("Final limited operation", ("somehost",)), + ("Second final limited operation", ("anotherhost", "someotherhost")), ] # Run 3 iterations of the test - each time shuffling the order of the