Skip to content
Snippets Groups Projects
Commit 5b33cb5e authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

Remove molecule dependencies

For some time now, we had some issues with molecule when building test
images for ansible-freeipa, and replaced the image creation with custom
build scripts that use commom container tools (like Dockerfiles and the
build command).

As there's no more tasks that require the use of molecule, this patch
removes the last bits used by it, and fixes documentation and lint
scripts and configuration.
parent c979843b
No related branches found
No related tags found
No related merge requests found
---
- name: Converge
hosts: all
tasks:
- include_tasks: prepare-common.yml
# In some distros DS won't start up after reboot
# This is due to a problem in 389-ds. See tickets:
# * https://pagure.io/389-ds-base/issue/47429
# * https://pagure.io/389-ds-base/issue/51039
#
# To avoid this problem we create the directories before starting IPA.
- name: Ensure lock dirs for DS exists
ansible.builtin.file:
state: directory
owner: dirsrv
group: dirsrv
path: "{{ item }}"
mode: 0770
loop:
- /var/lock/dirsrv/
- /var/lock/dirsrv/slapd-TEST-LOCAL/
- name: Ensure IPA server is up an running
ansible.builtin.service:
name: ipa
state: started
- name: Wait for krb5dkc to be running
ansible.builtin.service_facts:
no_log: True
register: result
until: "'krb5kdc.service' in result.ansible_facts.services and \
result.ansible_facts.services['krb5kdc.service'].state == 'running'"
retries: 30
delay: 5
- name: Check if TGT is available for admin.
ansible.builtin.shell:
cmd: echo SomeADMINpassword | kinit -c ansible_freeipa_cache admin
register: result
until: not result.failed
retries: 30
delay: 5
- name: Cleanup TGT.
ansible.builtin.shell:
cmd: kdestroy -c ansible_freeipa_cache -A
../../../roles/
\ No newline at end of file
......@@ -102,48 +102,16 @@ The pytests are tests that will execute small playbooks and then will verify the
To select only these tests on a test execution use the option `-m "not playbook"`.
## Running tests in a docker container
## Running tests in a container
It's also possible to run the tests in a container.
### Creating a container to run the tests
Before setting up a container you will need to install molecule framework:
```
pip install molecule-plugins[docker]
```
Now you can start a test container using the following command:
```
molecule create -s c8s
```
Note: Currently the containers available for running the tests are:
* fedora-latest
* centos-7
* c8s
* c9s
### Running the tests inside the container
It's also possible to run the tests in a container. Use the script `infra/image/start.sh` to start a container.
To run the tests you will use pytest (works the same as for VMs).
```
RUN_TESTS_IN_DOCKER=1 IPA_SERVER_HOST=c8s pytest
RUN_TESTS_IN_DOCKER=podman IPA_SERVER_HOST=ansbile-freeipa-tests pytest -m "playbook"
```
### Cleaning up after tests
After running the tests you should probably destroy the test container using:
```
molecule destroy -s c8s
```
See [Running the tests](#running-the-tests) section for more information on available options.
## Running local tests with upstream CI images
To run tests locally using the same images used by upstream CI use `utils/run-tests.sh`.
......@@ -172,8 +140,6 @@ By default the tests are executed against the latest version of the Fedora image
utils/run-tests.sh -i c9s tests/host/test_host.yml
```
## Upcoming/desired improvements:
* A script to pre-config the complete test environment using virsh.
* A test matrix to run tests against different distros in parallel (probably using tox).
* A test matrix to run tests against different distros in parallel.
......@@ -35,7 +35,6 @@ echo -e "${INFO}Running 'yamllint'...${RST}"
yaml_dirs=(
"tests"
"playbooks"
"molecule"
"roles"
)
yamllint -f colored "${yaml_dirs[@]}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment