Skip to content

Commit

Permalink
test: create the Queue in test (ansible#627)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mkanoor authored Dec 7, 2023
1 parent 080e9a7 commit 8743f53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/unit/action/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 11 additions & 1 deletion tests/unit/action/test_controller.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 = {
Expand All @@ -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

0 comments on commit 8743f53

Please sign in to comment.