diff --git a/.ansible-lint b/.ansible-lint index 67136a0371f56022170446945fb1ffc8b5854bfd..28fc3ac24fc2f4f95996e327b2547025425bcf35 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,7 +7,6 @@ exclude_paths: - .tox/ - .venv/ - .yamllint - - molecule/ - tests/azure/ - meta/runtime.yml - requirements-docker.yml diff --git a/molecule/c8s-build/Dockerfile b/molecule/c8s-build/Dockerfile deleted file mode 100644 index 7bdc1764715ddabb87fb0bdbb13204ad72144cdc..0000000000000000000000000000000000000000 --- a/molecule/c8s-build/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM quay.io/centos/centos:stream8 -ENV container=docker - -RUN rm -fv /var/cache/dnf/metadata_lock.pid; \ -dnf makecache; \ -dnf --assumeyes install \ - /usr/bin/python3 \ - /usr/bin/python3-config \ - /usr/bin/dnf-3 \ - sudo \ - bash \ - systemd \ - procps-ng \ - iproute && \ -dnf clean all; \ -(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ -rm -f /lib/systemd/system/multi-user.target.wants/*;\ -rm -f /etc/systemd/system/*.wants/*;\ -rm -f /lib/systemd/system/local-fs.target.wants/*; \ -rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ -rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ -rm -f /lib/systemd/system/basic.target.wants/*;\ -rm -f /lib/systemd/system/anaconda.target.wants/*; \ -rm -rf /var/cache/dnf/; - -STOPSIGNAL RTMIN+3 - -VOLUME ["/sys/fs/cgroup"] - -CMD ["/usr/sbin/init"] diff --git a/molecule/c8s-build/molecule.yml b/molecule/c8s-build/molecule.yml deleted file mode 100644 index 8855215190e13f2f6f7b535385cc07b4284d46e9..0000000000000000000000000000000000000000 --- a/molecule/c8s-build/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: c8s-build - image: "quay.io/centos/centos:stream8" - dockerfile: Dockerfile - hostname: ipaserver.test.local - dns_servers: - - 8.8.8.8 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare-build.yml -prerun: false diff --git a/molecule/c8s/molecule.yml b/molecule/c8s/molecule.yml deleted file mode 100644 index 79f35c547a21e4ff869e66f1c17d054b3b39d9d6..0000000000000000000000000000000000000000 --- a/molecule/c8s/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: c8s - image: quay.io/ansible-freeipa/upstream-tests:c8s - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 127.0.0.1 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare.yml -prerun: false diff --git a/molecule/c9s-build/Dockerfile b/molecule/c9s-build/Dockerfile deleted file mode 100644 index 2bb39a10f9ce1595b6fef9e3139ee4d5e4d2377f..0000000000000000000000000000000000000000 --- a/molecule/c9s-build/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM quay.io/centos/centos:stream9 -ENV container=docker - -RUN rm -fv /var/cache/dnf/metadata_lock.pid; \ -dnf makecache; \ -dnf --assumeyes install \ - /usr/bin/python3 \ - /usr/bin/dnf-3 \ - sudo \ - bash \ - systemd \ - procps-ng \ - iproute && \ -dnf clean all; \ -(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ -rm -f /lib/systemd/system/multi-user.target.wants/*;\ -rm -f /etc/systemd/system/*.wants/*;\ -rm -f /lib/systemd/system/local-fs.target.wants/*; \ -rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ -rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ -rm -f /lib/systemd/system/basic.target.wants/*;\ -rm -f /lib/systemd/system/anaconda.target.wants/*; \ -rm -rf /var/cache/dnf/; - -STOPSIGNAL RTMIN+3 - -VOLUME ["/sys/fs/cgroup"] - -CMD ["/usr/sbin/init"] diff --git a/molecule/c9s-build/molecule.yml b/molecule/c9s-build/molecule.yml deleted file mode 100644 index dfa654804578e69905903a8726141e4ac1b87c00..0000000000000000000000000000000000000000 --- a/molecule/c9s-build/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: c9s-build - image: "quay.io/centos/centos:stream9" - dockerfile: Dockerfile - hostname: ipaserver.test.local - dns_servers: - - 8.8.8.8 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare-build.yml -prerun: false diff --git a/molecule/c9s/molecule.yml b/molecule/c9s/molecule.yml deleted file mode 100644 index 7aba52252912d9709c9ce604911c6554ce406347..0000000000000000000000000000000000000000 --- a/molecule/c9s/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: c9s - image: quay.io/ansible-freeipa/upstream-tests:c9s - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 127.0.0.1 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare.yml -prerun: false diff --git a/molecule/centos-7-build/molecule.yml b/molecule/centos-7-build/molecule.yml deleted file mode 100644 index e88e1208ad5886e5b19faf177f722c83dde32f4d..0000000000000000000000000000000000000000 --- a/molecule/centos-7-build/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: centos-7-build - image: centos/systemd - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 8.8.8.8 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare-build.yml -prerun: false diff --git a/molecule/centos-7/molecule.yml b/molecule/centos-7/molecule.yml deleted file mode 100644 index 5cb077e233de02558c88012c75c25288366da761..0000000000000000000000000000000000000000 --- a/molecule/centos-7/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: centos-7 - image: quay.io/ansible-freeipa/upstream-tests:centos-7 - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 127.0.0.1 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare.yml -prerun: false diff --git a/molecule/default b/molecule/default deleted file mode 120000 index 768be926fb77dacebb0865765fcfed2e64b5643a..0000000000000000000000000000000000000000 --- a/molecule/default +++ /dev/null @@ -1 +0,0 @@ -fedora-latest \ No newline at end of file diff --git a/molecule/fedora-latest-build/Dockerfile b/molecule/fedora-latest-build/Dockerfile deleted file mode 100644 index f3c2ef6281d6bd7a1abd6641191c91c71f3e04c8..0000000000000000000000000000000000000000 --- a/molecule/fedora-latest-build/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM fedora:latest -ENV container=docker - -RUN rm -fv /var/cache/dnf/metadata_lock.pid; \ -dnf makecache; \ -dnf --assumeyes install \ - /usr/bin/python3 \ - /usr/bin/python3-config \ - /usr/bin/dnf-3 \ - sudo \ - bash \ - systemd \ - procps-ng \ - iproute && \ -dnf clean all; \ -(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ -rm -f /lib/systemd/system/multi-user.target.wants/*;\ -rm -f /etc/systemd/system/*.wants/*;\ -rm -f /lib/systemd/system/local-fs.target.wants/*; \ -rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ -rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ -rm -f /lib/systemd/system/basic.target.wants/*;\ -rm -f /lib/systemd/system/anaconda.target.wants/*; \ -rm -rf /var/cache/dnf/; - -STOPSIGNAL RTMIN+3 - -VOLUME ["/sys/fs/cgroup"] - -CMD ["/usr/sbin/init"] diff --git a/molecule/fedora-latest-build/molecule.yml b/molecule/fedora-latest-build/molecule.yml deleted file mode 100644 index 10635d3a8112126cde7264c250ba5cb69095a6cf..0000000000000000000000000000000000000000 --- a/molecule/fedora-latest-build/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: fedora-latest-build - image: "fedora:latest" - dockerfile: Dockerfile - hostname: ipaserver.test.local - dns_servers: - - 8.8.8.8 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare-build.yml -prerun: false diff --git a/molecule/fedora-latest/molecule.yml b/molecule/fedora-latest/molecule.yml deleted file mode 100644 index 94c4fc4a0cf72c4fe42aa7f09d9a2b2cac13d0c2..0000000000000000000000000000000000000000 --- a/molecule/fedora-latest/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: fedora-latest - image: quay.io/ansible-freeipa/upstream-tests:fedora-latest - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 127.0.0.1 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare.yml -prerun: false diff --git a/molecule/fedora-rawhide-build/Dockerfile b/molecule/fedora-rawhide-build/Dockerfile deleted file mode 100644 index f1a1c124d30d845a480b0b3cd841670eb95e96a0..0000000000000000000000000000000000000000 --- a/molecule/fedora-rawhide-build/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM fedora:rawhide -ENV container=docker - -RUN rm -fv /var/cache/dnf/metadata_lock.pid; \ -dnf makecache; \ -dnf --assumeyes install \ - /usr/bin/python3 \ - /usr/bin/python3-config \ - /usr/bin/dnf-3 \ - sudo \ - bash \ - systemd \ - procps-ng \ - iproute && \ -dnf clean all; \ -(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ -rm -f /lib/systemd/system/multi-user.target.wants/*;\ -rm -f /etc/systemd/system/*.wants/*;\ -rm -f /lib/systemd/system/local-fs.target.wants/*; \ -rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ -rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ -rm -f /lib/systemd/system/basic.target.wants/*;\ -rm -f /lib/systemd/system/anaconda.target.wants/*; \ -rm -rf /var/cache/dnf/; - -STOPSIGNAL RTMIN+3 - -VOLUME ["/sys/fs/cgroup"] - -CMD ["/usr/sbin/init"] diff --git a/molecule/fedora-rawhide-build/molecule.yml b/molecule/fedora-rawhide-build/molecule.yml deleted file mode 100644 index c8afa32964ab8ee7bdae8d471e59e9c44b6a053a..0000000000000000000000000000000000000000 --- a/molecule/fedora-rawhide-build/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: fedora-rawhide-build - image: "fedora:rawhide" - dockerfile: Dockerfile - hostname: ipaserver.test.local - dns_servers: - - 8.8.8.8 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare-build.yml -prerun: false diff --git a/molecule/fedora-rawhide/molecule.yml b/molecule/fedora-rawhide/molecule.yml deleted file mode 100644 index 6ff53e9b4e6b890b12d26903abc9296f35367141..0000000000000000000000000000000000000000 --- a/molecule/fedora-rawhide/molecule.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -driver: - name: docker -platforms: - - name: fedora-rawhide - image: quay.io/ansible-freeipa/upstream-tests:fedora-rawhide - pre_build_image: true - hostname: ipaserver.test.local - dns_servers: - - 127.0.0.1 - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - command: /usr/sbin/init - privileged: true -provisioner: - name: ansible - playbooks: - prepare: ../resources/playbooks/prepare.yml -prerun: false diff --git a/molecule/resources/playbooks/library b/molecule/resources/playbooks/library deleted file mode 120000 index 0140dc6d3e793348663e9b0e959189b9ec1e6b9f..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/library +++ /dev/null @@ -1 +0,0 @@ -../../../plugins/modules/ \ No newline at end of file diff --git a/molecule/resources/playbooks/module_utils b/molecule/resources/playbooks/module_utils deleted file mode 120000 index 2b1d4840b33b6d90bad753345c96c360561c64e6..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/module_utils +++ /dev/null @@ -1 +0,0 @@ -../../../plugins/module_utils/ \ No newline at end of file diff --git a/molecule/resources/playbooks/prepare-build.yml b/molecule/resources/playbooks/prepare-build.yml deleted file mode 100644 index 5e8e5a92e152d1f59a4f49d83697302dfb1f93bf..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/prepare-build.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: Converge - hosts: all - tasks: - - include_tasks: prepare-common.yml - - - name: Ensure sudo package is installed - package: - name: sudo - - - name: Ensure nss package is updated - package: - name: nss - state: latest # noqa 403 - - - include_role: - name: ipaserver - vars: - ipaserver_setup_dns: yes - ipaserver_setup_kra: yes - ipaserver_auto_forwarders: yes - ipaserver_no_dnssec_validation: yes - ipaserver_auto_reverse: yes - ipaadmin_password: SomeADMINpassword - ipadm_password: SomeDMpassword - ipaserver_domain: test.local - ipaserver_realm: TEST.LOCAL - ipaclient_no_ntp: yes diff --git a/molecule/resources/playbooks/prepare-common.yml b/molecule/resources/playbooks/prepare-common.yml deleted file mode 100644 index 1e1a60227d7283b5c61a15a6a22481a482320649..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/prepare-common.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# IPA depends on IPv6 and without it dirsrv service won't start. -- name: Ensure IPv6 is ENABLED - ansible.posix.sysctl: - name: "{{ item.name }}" - value: "{{ item.value }}" - sysctl_set: yes - state: present - reload: yes - with_items: - - name: net.ipv6.conf.all.disable_ipv6 - value: 0 - - name: net.ipv6.conf.lo.disable_ipv6 - value: 0 - - name: net.ipv6.conf.eth0.disable_ipv6 - value: 1 - -# Set fs.protected_regular to 0 -# This is needed in some IPA versions in order to get KRA enabled. -# See https://pagure.io/freeipa/issue/7906 for more information. -- name: stat protected_regular - ansible.builtin.stat: - path: /proc/sys/fs/protected_regular - register: result - -- name: Ensure fs.protected_regular is disabled - ansible.posix.sysctl: - name: fs.protected_regular - value: 0 - sysctl_set: yes - state: present - reload: yes - when: result.stat.exists diff --git a/molecule/resources/playbooks/prepare.yml b/molecule/resources/playbooks/prepare.yml deleted file mode 100644 index deaa092b3318a5c288e7525932e1000ba453a3eb..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/prepare.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- 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 diff --git a/molecule/resources/playbooks/roles b/molecule/resources/playbooks/roles deleted file mode 120000 index e2b799b9d705b8545e7242a920921d8221791d4b..0000000000000000000000000000000000000000 --- a/molecule/resources/playbooks/roles +++ /dev/null @@ -1 +0,0 @@ -../../../roles/ \ No newline at end of file diff --git a/tests/README.md b/tests/README.md index 1e9d4e4a194d47b99e2fa94d02202678d3765288..298078b8681f5e650001ae07801512a344c75468 100644 --- a/tests/README.md +++ b/tests/README.md @@ -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. diff --git a/utils/lint_check.sh b/utils/lint_check.sh index 25d4f8878c0b4cd551daaf370961c08bcabe8de6..76c8c2ace182b2862342d3d5fdd6510928fa52dd 100755 --- a/utils/lint_check.sh +++ b/utils/lint_check.sh @@ -35,7 +35,6 @@ echo -e "${INFO}Running 'yamllint'...${RST}" yaml_dirs=( "tests" "playbooks" - "molecule" "roles" ) yamllint -f colored "${yaml_dirs[@]}"