From 8743f53a1a7bf3eb24dfbc4cbe03c1cd1fad66da Mon Sep 17 00:00:00 2001 From: Madhu Kanoor Date: Thu, 7 Dec 2023 09:23:43 -0500 Subject: [PATCH] test: create the Queue in test (#627) Creating the Queue in the fixture seems to be causing an issue https://github.com/ansible/ansible-rulebook/actions/runs/7093631506/job/19307405050?pr=625 --- tests/unit/action/conftest.py | 1 + tests/unit/action/test_controller.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/unit/action/conftest.py b/tests/unit/action/conftest.py index a664eee66..459d28b27 100644 --- a/tests/unit/action/conftest.py +++ b/tests/unit/action/conftest.py @@ -17,6 +17,7 @@ def base_metadata(): ) +# TODO : Seems like asyncio.Queue() in a fixture is causing test failure @pytest.fixture def base_control(): return Control( diff --git a/tests/unit/action/test_controller.py b/tests/unit/action/test_controller.py index 5ba46db39..d06869bfa 100644 --- a/tests/unit/action/test_controller.py +++ b/tests/unit/action/test_controller.py @@ -1,5 +1,8 @@ +import asyncio + import pytest +from ansible_rulebook.action.control import Control from ansible_rulebook.action.run_job_template import RunJobTemplate from ansible_rulebook.action.run_workflow_template import RunWorkflowTemplate @@ -30,7 +33,7 @@ ) @pytest.mark.asyncio async def test_controller_custom_host_limit( - input, expected, template_class, base_metadata, base_control + input, expected, template_class, base_metadata ): """Test controller templates process the host limit in job_args.""" action_args = { @@ -42,5 +45,12 @@ async def test_controller_custom_host_limit( "set_facts": True, "job_args": input, } + base_control = Control( + queue=asyncio.Queue(), + inventory="abc", + hosts=["all"], + variables={"a": 1}, + project_data_file="", + ) template = template_class(base_metadata, base_control, **action_args) assert template.job_args["limit"] == expected