diff --git a/changelogs/fragments/ansible-test-inventory-path.yaml b/changelogs/fragments/ansible-test-inventory-path.yaml new file mode 100644 index 00000000000..3428ae2e3c0 --- /dev/null +++ b/changelogs/fragments/ansible-test-inventory-path.yaml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - Fix path to inventory file for ``windows-integration`` and ``network-integration`` commands for collections. diff --git a/test/lib/ansible_test/_internal/cli/compat.py b/test/lib/ansible_test/_internal/cli/compat.py index b1ca08e39c5..cf6c01f1ef4 100644 --- a/test/lib/ansible_test/_internal/cli/compat.py +++ b/test/lib/ansible_test/_internal/cli/compat.py @@ -50,6 +50,10 @@ from ..host_configs import ( WindowsRemoteConfig, ) +from ..data import ( + data_context, +) + def filter_python(version, versions): # type: (t.Optional[str], t.Optional[t.List[str]]) -> t.Optional[str] """If a Python version is given and is in the given version list, return that Python version, otherwise return None.""" @@ -467,9 +471,9 @@ def default_targets( ): # type: (...) -> t.List[HostConfig] """Return a list of default targets for the given target mode.""" if mode == TargetMode.WINDOWS_INTEGRATION: - targets = [WindowsInventoryConfig(path=os.path.abspath('test/integration/inventory.winrm'))] + targets = [WindowsInventoryConfig(path=os.path.abspath(os.path.join(data_context().content.integration_path, 'inventory.winrm')))] elif mode == TargetMode.NETWORK_INTEGRATION: - targets = [NetworkInventoryConfig(path=os.path.abspath('test/integration/inventory.networking'))] + targets = [NetworkInventoryConfig(path=os.path.abspath(os.path.join(data_context().content.integration_path, 'inventory.networking')))] elif mode.multiple_pythons: targets = controller.get_default_targets(HostContext(controller_config=controller)) else: