mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-04 23:37:12 +00:00
Improve --docker arguments to ansible-test (#12070)
Improve --docker arguments to ansible-test.
This commit is contained in:
parent
2f83a5b084
commit
bb93811ea6
9 changed files with 15 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
ansible-test integration -v keycloak_authentication --allow-unsupported --docker fedora --docker-network host
|
||||
|
|
@ -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
|
||||
ansible-test integration -v keycloak_authentication_v2 --allow-unsupported --docker fedora --docker-network host
|
||||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue