Testing

Continuous integration

The collection is tested with a molecule setup covering the included roles and verifying correct installation and idempotence. In order to run the molecule tests locally with python 3.9 available, after cloning the repository:

pip install yamllint 'molecule[docker]~=3.5.2' ansible-core flake8 ansible-lint voluptuous
molecule test --all

Integration testing

Demo repositories which depend on the collection, and aggregate functionality with other middleware_automation collections, are automatically rebuilt at every collection release to ensure non-breaking changes and consistent behaviour.

The repositories are:

  • none at the moment

Test playbooks

Sample playbooks are provided in the playbooks/ directory; to run the playbooks locally (requires a rhel system with python 3.9+, ansible, and systemd) the steps are as follows:

  1. Setup environment

pip install ansible-core
  1. Clone the repository

git clone https://github.com/ansible-middleware/amq_streams
cd amq_streams
  1. Install collection dependencies

ansible-galaxy collection install -r requirements.yml
  1. Install collection python deps

pip install -r requirements.txt
  1. Create inventory for localhost

cat << EOF > inventory2
[amq_streams]
localhost ansible_connection=local
EOF
  1. Run the playbook

ansible-playbook -i inventory playbooks/amq_streams.yml