Automate the execution of all molecule scenarios (#17)

# Context

This PR implements the following [issue](#12).

# Acceptance criteria

- [ ] A Task task for running all Ansible Molecule scenarios has been introduced.
- [ ] A Task task for running selected Ansible Molecule scenarios has been introduced.
- [ ] `README.md` has been updated to provide correct guidance on executing Ansible Molecule scenarios.

Co-authored-by: emo <esimeonov@gmail.com>
Reviewed-on: #17
This commit is contained in:
emil 2024-03-04 23:59:02 +00:00
parent 7d6f05e201
commit 48ac6c0651
2 changed files with 20 additions and 15 deletions

View File

@ -217,22 +217,12 @@ Navigate to the root folder of the local copy of this git repository.
cd test_linux_containers
```
Install locally a snapshot version of `theliberatededge.test_linux_containers`
that will be used as the foundation for automated testing.
Run the following task to execute all of the Ansible Molecule test scenarios
in the project.
```
LC_ALL=C.UTF-8 ansible-galaxy install -r requirements-test.yml --force
LTE_CONTAINER_ROOT_PWD=<password> task test-all
```
Execute all existing Ansible Molecule scenarios.
```
cd extensions
```
```
LC_ALL=C.UTF-8 \
LTE_CONTAINER_NAME=<container name> \
LTE_CONTAINER_ROOT_PWD=<password> \
molecule test --all
```
`LTE_CONTAINER_ROOT_PWD` is an environment variable denoting the password
of the `root` user in the testing container.

View File

@ -13,3 +13,18 @@ tasks:
lint-ansible:
deps: [lint-yml]
cmds: [LC_ALL=C.UTF-8 ansible-lint .]
init-tests:
cmds:
- LC_ALL=C.UTF-8 ansible-galaxy install -r requirements-test.yml --force
test-all:
deps: [init-tests]
dir: extensions
cmds:
- |
LC_ALL=C.UTF-8 \
LTE_CONTAINER_NAME={{ .LTE_CONTAINER_NAME }} \
LTE_CONTAINER_ROOT_PWD={{ .LTE_CONTAINER_ROOT_PWD }} \
molecule test --all
vars:
LTE_CONTAINER_NAME:
sh: cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1