From bb93811ea66c85072741a483fa6ff2e055ca1d21 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 17 May 2026 10:47:56 +0200 Subject: [PATCH] Improve --docker arguments to ansible-test (#12070) Improve --docker arguments to ansible-test. --- CONTRIBUTING.md | 8 ++++---- .../integration/targets/keycloak_authentication/README.md | 2 +- .../targets/keycloak_authentication_v2/README.md | 2 +- .../targets/keycloak_client_rolescope/README.md | 2 +- .../integration/targets/keycloak_component_info/README.md | 2 +- .../targets/keycloak_identity_provider/README.md | 2 +- tests/integration/targets/keycloak_realm/README.md | 2 +- tests/integration/targets/keycloak_role/README.md | 2 +- .../modules/interfaces_file/interfaces_file-README.md | 8 ++++---- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77e66cd719..8575d4717d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -177,14 +177,14 @@ Integration tests on Docker have the following parameters: For plugins, the plugin type is added before the plugin's short name, for example `callback_yaml` for the `community.general.yaml` callback. ```.bash -# Test all plugins/modules on fedora40 -ansible-test integration -v --docker fedora40 +# Test all plugins/modules on fedora +ansible-test integration -v --docker fedora # Template ansible-test integration -v --docker image_name test_name -# Example community.general.ini_file module on fedora40 Docker image: -ansible-test integration -v --docker fedora40 ini_file +# Example community.general.ini_file module on fedora Docker image: +ansible-test integration -v --docker fedora ini_file ``` #### Without isolation diff --git a/tests/integration/targets/keycloak_authentication/README.md b/tests/integration/targets/keycloak_authentication/README.md index 03ca31b199..f7915a9acc 100644 --- a/tests/integration/targets/keycloak_authentication/README.md +++ b/tests/integration/targets/keycloak_authentication/README.md @@ -7,4 +7,4 @@ SPDX-License-Identifier: GPL-3.0-or-later Run integration tests: - ansible-test integration -v keycloak_authentication --allow-unsupported --docker fedora35 --docker-network host \ No newline at end of file + ansible-test integration -v keycloak_authentication --allow-unsupported --docker fedora --docker-network host \ No newline at end of file diff --git a/tests/integration/targets/keycloak_authentication_v2/README.md b/tests/integration/targets/keycloak_authentication_v2/README.md index a07b6a615b..1404430b16 100644 --- a/tests/integration/targets/keycloak_authentication_v2/README.md +++ b/tests/integration/targets/keycloak_authentication_v2/README.md @@ -7,4 +7,4 @@ SPDX-License-Identifier: GPL-3.0-or-later Run integration tests: - ansible-test integration -v keycloak_authentication_v2 --allow-unsupported --docker fedora42 --docker-network host \ No newline at end of file + ansible-test integration -v keycloak_authentication_v2 --allow-unsupported --docker fedora --docker-network host \ No newline at end of file diff --git a/tests/integration/targets/keycloak_client_rolescope/README.md b/tests/integration/targets/keycloak_client_rolescope/README.md index cd1152dad8..f485135134 100644 --- a/tests/integration/targets/keycloak_client_rolescope/README.md +++ b/tests/integration/targets/keycloak_client_rolescope/README.md @@ -11,7 +11,7 @@ To run Keycloak component info module's integration test, start a keycloak serve Run integration tests: - ansible-test integration -v keycloak_client_rolescope --allow-unsupported --docker fedora35 --docker-network host + ansible-test integration -v keycloak_client_rolescope --allow-unsupported --docker fedora --docker-network host Cleanup: diff --git a/tests/integration/targets/keycloak_component_info/README.md b/tests/integration/targets/keycloak_component_info/README.md index cf4f222b03..8e948a1138 100644 --- a/tests/integration/targets/keycloak_component_info/README.md +++ b/tests/integration/targets/keycloak_component_info/README.md @@ -11,7 +11,7 @@ To run Keycloak component info module's integration test, start a keycloak serve docker run -d --rm --name mykeycloak --link myldap:ldap.example.com -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=password quay.io/keycloak/keycloak:latest start-dev --http-relative-path /auth Run integration tests: - ansible-test integration -v keycloak_component_info --allow-unsupported --docker fedora35 --docker-network host + ansible-test integration -v keycloak_component_info --allow-unsupported --docker fedora --docker-network host Cleanup: diff --git a/tests/integration/targets/keycloak_identity_provider/README.md b/tests/integration/targets/keycloak_identity_provider/README.md index 204ebbed66..672801ae7a 100644 --- a/tests/integration/targets/keycloak_identity_provider/README.md +++ b/tests/integration/targets/keycloak_identity_provider/README.md @@ -11,7 +11,7 @@ To run Keycloak component info module's integration test, start a keycloak serve Run integration tests: - ansible-test integration -v keycloak_identity_provider --allow-unsupported --docker fedora35 --docker-network host + ansible-test integration -v keycloak_identity_provider --allow-unsupported --docker fedora --docker-network host Cleanup: diff --git a/tests/integration/targets/keycloak_realm/README.md b/tests/integration/targets/keycloak_realm/README.md index c0df89e69b..83c8b231cf 100644 --- a/tests/integration/targets/keycloak_realm/README.md +++ b/tests/integration/targets/keycloak_realm/README.md @@ -11,7 +11,7 @@ To run Keycloak component info module's integration test, start a keycloak serve Run integration tests: - ansible-test integration -v keycloak_realm --allow-unsupported --docker fedora35 --docker-network host + ansible-test integration -v keycloak_realm --allow-unsupported --docker fedora --docker-network host Cleanup: diff --git a/tests/integration/targets/keycloak_role/README.md b/tests/integration/targets/keycloak_role/README.md index 88aa727e8f..45904cd621 100644 --- a/tests/integration/targets/keycloak_role/README.md +++ b/tests/integration/targets/keycloak_role/README.md @@ -13,7 +13,7 @@ Source Ansible env-setup from ansible github repository Run integration tests: - ansible-test integration -v keycloak_role --allow-unsupported --docker fedora35 --docker-network host + ansible-test integration -v keycloak_role --allow-unsupported --docker fedora --docker-network host Cleanup: diff --git a/tests/unit/plugins/modules/interfaces_file/interfaces_file-README.md b/tests/unit/plugins/modules/interfaces_file/interfaces_file-README.md index aa9298f370..4266a7302b 100644 --- a/tests/unit/plugins/modules/interfaces_file/interfaces_file-README.md +++ b/tests/unit/plugins/modules/interfaces_file/interfaces_file-README.md @@ -15,13 +15,13 @@ SPDX-License-Identifier: GPL-3.0-or-later 1. Clone project to `ansible_collections/community/general` 2. Change directory to the project one `cd ansible_collections/community/general` -3. Run `ansible-test units --docker -v --python 3.10 tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py` +3. Run `ansible-test units --docker -v --python 3.14 tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py` ## Adding tests 1. New configurations should added to `input` directory 2. New test cases should be defined in `test_interfaces_file.py`. Same for new test functions if needed -3. On first test run for a new combination of a test case and an interface configuration new set of golden files will be generated. In case of docker-based test approach that's going to fail due to RO mount option. The workaround is to run tests locally with Python 3 (3.7 in this example): - 1. Install required modules with `pip3.7 install pytest-xdist pytest-mock mock` - 3. Run tests with `ansible-test units --python 3.10 tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py` +3. On first test run for a new combination of a test case and an interface configuration new set of golden files will be generated. In case of docker-based test approach that's going to fail due to RO mount option. The workaround is to run tests locally with Python 3: + 1. Install required modules with `pip install pytest-xdist pytest-mock mock` + 2. Run tests with `ansible-test units --python 3.14 tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py` 4. Carefully verify newly created golden output files!