Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport][release_2.3] Test both runtimes in unit tests (#1155) #1157

Merged
merged 1 commit into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/unit/config/test__base.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/test_ansible_cfg.py
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/test_command.py
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions test/unit/config/test_doc.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/test_inventory.py
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/unit/config/test_runner.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_cleanup.py
Expand Up @@ -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()
Expand Down