fix(molecule): Add ability to run molecule on Fedora
This patch adds the support for running the molecule tests on Fedora through the molecule command. This patch also updates the developer's guide with all the instructions to do so. JIRA: #VALFRWK-703 Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com> Change-Id: I6852fe440c62348fcf795dda44403a3ec68a7e19 (cherry picked from commit17c3c907b7
) (cherry picked from commitbe873a116c
) (cherry picked from commit95a0c41afd
) (cherry picked from commit36b67f961f
)
This commit is contained in:
parent
267f27c6ef
commit
27f530dcf2
28
bindep.txt
28
bindep.txt
|
@ -18,28 +18,22 @@ gcc-c++ [platform:rpm]
|
|||
git [platform:rpm]
|
||||
libffi-devel [platform:rpm]
|
||||
openssl-devel [platform:rpm]
|
||||
|
||||
libxml2-dev [platform:dpkg platform:apk]
|
||||
libxml2-devel [platform:rpm]
|
||||
libxslt-devel [platform:rpm]
|
||||
libxslt1-dev [platform:dpkg]
|
||||
libxslt-dev [platform:apk]
|
||||
|
||||
# RH Mechanisms
|
||||
python-rhsm-certificates [platform: redhat]
|
||||
|
||||
podman [platform:rpm]
|
||||
python-devel [platform:rpm !platform:rhel-8 !platform:centos-8]
|
||||
python-devel [platform:rpm !platform:rhel-8 !platform:centos-8 !platform:fedora]
|
||||
python3-devel [platform:rpm !platform:rhel-7 !platform:centos-7]
|
||||
PyYAML [platform:rpm !platform:rhel-8 !platform:centos-8]
|
||||
PyYAML [platform:rpm !platform:rhel-8 !platform:centos-8 !platform:fedora]
|
||||
python3-pyyaml [platform:rpm !platform:rhel-7 !platform:centos-7]
|
||||
python3-dnf [platform:rpm !platform:rhel-7 !platform:centos-7]
|
||||
|
||||
# For SELinux
|
||||
libselinux-python [platform:rpm !platform:rhel-8 !platform:centos-8]
|
||||
libsemanage-python [platform:redhat !platform:rhel-8 !platform:centos-8]
|
||||
libselinux-python3 [platform:rpm !platform:rhel-7 !platform:centos-7]
|
||||
libsemanage-python3 [platform:redhat !platform:rhel-7 !platform:centos-7]
|
||||
# RH Mechanisms
|
||||
python-rhsm-certificates [platform:redhat]
|
||||
|
||||
# SELinux cent7
|
||||
libselinux-python3 [platform:rpm !platform:rhel-8 !platform:centos-8]
|
||||
libsemanage-python3 [platform:redhat !platform:rhel-8 !platform:centos-8]
|
||||
# SELinux cent8
|
||||
python3-libselinux [platform:rpm !platform:rhel-7 !platform:centos-7]
|
||||
python3-libsemanage [platform:redhat !platform:rhel-7 !platform:centos-7]
|
||||
|
||||
# Required for compressing collected log files in CI
|
||||
gzip
|
||||
|
|
|
@ -694,6 +694,10 @@ a role with tags.
|
|||
$ export TRIPLEO_JOB_ANSIBLE_ARGS="--skip-tags tag_one,tag_two"
|
||||
$ ./scripts/run-local-test ${ROLENAME}
|
||||
|
||||
|
||||
Running molecule tests manually
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Role based testing with molecule can be executed directly from within
|
||||
the role directory.
|
||||
|
||||
|
@ -712,9 +716,26 @@ the role directory.
|
|||
|
||||
.. note::
|
||||
|
||||
Some roles depend on some packages which are available only through the EPEL
|
||||
repositories. So, please ensure you have installed them on your CentOS 8 host
|
||||
before running molecule tests.
|
||||
Each molecule tests are configured to bind mount a read-only volume on the
|
||||
container where the tests are running:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
volumes:
|
||||
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||
|
||||
It is an OpenStack Zuul requirement for detecting if we are on a CI node. Of
|
||||
course, when running your molecule test on your workstation, it is going
|
||||
to fail because you don't have the empty `mirror_info.sh` script in the
|
||||
`/etc/ci/` directory. You can workaround this by creating it in your
|
||||
workstation or removing the volume key in the global configuration file for
|
||||
molecule.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ sudo mkdir -p /etc/ci
|
||||
$ sudo touch /etc/ci/mirror_info.sh
|
||||
|
||||
|
||||
|
||||
Before running basic molecule tests, it is recommended to install all
|
||||
|
@ -722,22 +743,35 @@ of the python dependencies in a virtual environment.
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
$ python -m virtualenv --system-site-packages "${HOME}/test-python"
|
||||
$ ${HOME}/test-python/bin/pip install -r requirements.txt \
|
||||
-r test-requirements.txt \
|
||||
-r molecule-requirements.txt
|
||||
$ source ${HOME}/test-python/bin/activate
|
||||
$ sudo dnf install python3 python3-virtualenv
|
||||
$ python3 -m virtualenv --system-site-packages "${HOME}/test-python"
|
||||
$ source "${HOME}/test-python/bin/activate"
|
||||
(test-python) $ python3 -m pip install "pip>=19.1.1" setuptools bindep --upgrade
|
||||
(test-python) $ scripts/./bindep-install
|
||||
(test-python) $ python3 -m pip install -r requirements.txt \
|
||||
-r test-requirements.txt \
|
||||
-r molecule-requirements.txt
|
||||
(test-python) $ ansible-galaxy install -fr ansible-collections-requirements.txt
|
||||
|
||||
|
||||
Now, it is important to install validations-common and tripleo-ansible as
|
||||
dependencies.
|
||||
|
||||
.. note::
|
||||
|
||||
`validation-common` contains Ansible Custom modules needed by
|
||||
`tripleo-validations` roles. That's the reason why we will need to clone it
|
||||
beforehand.
|
||||
|
||||
Cloning `tripleo-ansible` project is only necessary in order to
|
||||
run the `molecule` test(s) for the `image_serve` role. Otherwise, you won't
|
||||
probably need it.
|
||||
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ cd tripleo-validations/
|
||||
$ for REPO in validations-common tripleo-ansible; do
|
||||
git clone https://opendev.org/openstack/${REPO} roles/roles.galaxy/${REPO}
|
||||
done
|
||||
$ for REPO in validations-common tripleo-ansible; do git clone https://opendev.org/openstack/${REPO} roles/roles.galaxy/${REPO}; done
|
||||
|
||||
|
||||
To run a basic molecule test, simply source the `ansible-test-env.rc`
|
||||
|
@ -745,6 +779,7 @@ file from the project root, and then execute the following commands.
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
(test-python) $ source ansible-test-env.rc
|
||||
(test-python) $ cd roles/${NEWROLENAME}/
|
||||
(test-python) $ molecule test --all
|
||||
|
||||
|
@ -756,7 +791,7 @@ the `--scenario-name` flag with the name of the desired scenario.
|
|||
|
||||
.. code-block:: console
|
||||
|
||||
(test-python) $ cd tripleo-validations/roles/${NEWROLENAME}/
|
||||
(test-python) $ cd roles/${NEWROLENAME}/
|
||||
(test-python) $ molecule test --scenario-name ${EXTRA_SCENARIO_NAME}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue