From fbcafc49226d1f0249b09be219021beda4a30374 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 4 Nov 2022 13:11:03 -0400 Subject: [PATCH] Test both runtimes in unit tests --- test/unit/config/test__base.py | 4 ++-- test/unit/config/test_ansible_cfg.py | 2 +- test/unit/config/test_command.py | 2 +- test/unit/config/test_doc.py | 4 ++-- test/unit/config/test_inventory.py | 2 +- test/unit/config/test_runner.py | 2 +- test/unit/test_cleanup.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/unit/config/test__base.py b/test/unit/config/test__base.py index 1eb42f8f5..aaf6c9227 100644 --- a/test/unit/config/test__base.py +++ b/test/unit/config/test__base.py @@ -288,7 +288,7 @@ def test_container_volume_mounting_with_Z(tmp_path, mocker): raise Exception('Could not find expected mount, args: {}'.format(new_args)) -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_containerization_settings(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() @@ -346,7 +346,7 @@ def test_containerization_settings(tmp_path, runtime, mocker): assert expected_command_start == rc.command -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_containerization_unsafe_write_setting(tmp_path, runtime, mocker): mock_containerized = mocker.patch('ansible_runner.config._base.BaseConfig.containerized', new_callable=mocker.PropertyMock) diff --git a/test/unit/config/test_ansible_cfg.py b/test/unit/config/test_ansible_cfg.py index ecc96bea7..8df741dbd 100644 --- a/test/unit/config/test_ansible_cfg.py +++ b/test/unit/config/test_ansible_cfg.py @@ -52,7 +52,7 @@ def test_prepare_config_invalid_action(): assert "Invalid action test, valid value is one of either list, dump, view" == exc.value.args[0] -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_prepare_config_command_with_containerization(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() diff --git a/test/unit/config/test_command.py b/test/unit/config/test_command.py index 75bc2db64..878f89892 100644 --- a/test/unit/config/test_command.py +++ b/test/unit/config/test_command.py @@ -61,7 +61,7 @@ def test_prepare_run_command_generic(): assert rc.execution_mode == BaseExecutionMode.GENERIC_COMMANDS -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_prepare_run_command_with_containerization(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() diff --git a/test/unit/config/test_doc.py b/test/unit/config/test_doc.py index 1058dac19..60d68e49c 100755 --- a/test/unit/config/test_doc.py +++ b/test/unit/config/test_doc.py @@ -58,7 +58,7 @@ def test_prepare_plugin_docs_command(): assert rc.execution_mode == BaseExecutionMode.ANSIBLE_COMMANDS -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_prepare_plugin_docs_command_with_containerization(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() @@ -129,7 +129,7 @@ def test_prepare_plugin_list_command(): assert rc.execution_mode == BaseExecutionMode.ANSIBLE_COMMANDS -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_prepare_plugin_list_command_with_containerization(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() diff --git a/test/unit/config/test_inventory.py b/test/unit/config/test_inventory.py index 65fbe5d34..623383657 100644 --- a/test/unit/config/test_inventory.py +++ b/test/unit/config/test_inventory.py @@ -84,7 +84,7 @@ def test_prepare_inventory_invalid_graph_response_format(): assert "'graph' action supports only 'json' response format" == exc.value.args[0] -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_prepare_inventory_command_with_containerization(tmp_path, runtime, mocker): mocker.patch.dict('os.environ', {'HOME': str(tmp_path)}, clear=True) tmp_path.joinpath('.ssh').mkdir() diff --git a/test/unit/config/test_runner.py b/test/unit/config/test_runner.py index d9ee6961b..67b662203 100644 --- a/test/unit/config/test_runner.py +++ b/test/unit/config/test_runner.py @@ -710,7 +710,7 @@ def test_container_volume_mounting_with_Z(mocker, tmp_path): raise Exception('Could not find expected mount, args: {}'.format(new_args)) -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_containerization_settings(tmp_path, runtime, mocker): mocker.patch('os.path.isdir', return_value=True) mocker.patch('os.path.exists', return_value=True) diff --git a/test/unit/test_cleanup.py b/test/unit/test_cleanup.py index d5a0f9785..b6d7986ac 100644 --- a/test/unit/test_cleanup.py +++ b/test/unit/test_cleanup.py @@ -47,7 +47,7 @@ def test_cleanup_command_grace_period(tmp_path): assert os.path.exists(new_dir) -@pytest.mark.test_all_runtimes +@pytest.mark.parametrize('runtime', ('docker', 'podman')) def test_registry_auth_cleanup(tmp_path, runtime): pdd_path = tmp_path / 'private_data_dir' pdd_path.mkdir()