You can test this locally using **DIND (docker in docker)** at your own computer using [ansible molecule](https://ansible.readthedocs.io/projects/molecule/installation/)
For testing this role, please reference [how to use molecule tests](https://git.cccv.de/fejao/c3infodesk-deployment-role-docker-images/-/tree/main/molecule)
- ### Testing requirements
You need docker installed at your system and the [ansible molecule](https://ansible.readthedocs.io/projects/molecule/installation/).
- #### Setting *DIND (docker in docker)*
You might have to set *DIND (docker in docker)* at your system, for linux, you can create the file **/etc/docker/daemon.json**
- ##### Enabling DIND at your system
And add the content and restart docker.
```json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"features": {
"buildkit": true
},
"experimental": true,
"cgroup-parent": "docker.slice"
}
```
- ### Using the molecule tests
- #### Configuring the *HOST_VAR_FILE_NAME* variable
For using the molecule tests you should pass the **HOST_VAR_FILE_NAME** environment variable, or the default value for testing is: **example_printer.yml**
For the values that can be used, you can lool at the files at the **inventories/host_vars** folder.
- ##### Molecule test example
Just go to the root of the role **roles/x3infodesk-deployment-role-dependencies** and run the command, here is an example for using the **HOST_VAR_FILE_NAME** as *example_buttons.yml*:
```bash
HOST_VAR_FILE_NAME="example_buttons.yml" molecule test
@@ -7,6 +7,7 @@ It's allways a good idea to test your things.
...
@@ -7,6 +7,7 @@ It's allways a good idea to test your things.
With **ansible molecule** you can test your role locally without the need of using a **real server** but a local **docker container**.
With **ansible molecule** you can test your role locally without the need of using a **real server** but a local **docker container**.
## Dependencies
## Dependencies
- ### molecule
- ### molecule
...
@@ -34,9 +35,26 @@ With **ansible molecule** you can test your role locally without the need of usi
...
@@ -34,9 +35,26 @@ With **ansible molecule** you can test your role locally without the need of usi
## Configuration
## Configuration
There's not much for configuring for using the tests
There's not much for configuring for using the tests
## Running the tests
## Running the tests
For running the **molecule tests** you just need to run the command:
```bash
- #### Configuring the *HOST_VAR_FILE_NAME* variable
molecule test
For using the molecule tests you should pass the **HOST_VAR_FILE_NAME** environment variable, or the default value for testing is: **example_printer.yml**
```
For the values that can be used, you can lool at the files at the **inventories/host_vars** folder.
- ##### Molecule test example
Just go to the root of the role **roles/x3infodesk-deployment-role-dependencies** and run the command, here is an example for using the **HOST_VAR_FILE_NAME** as *example_buttons.yml*:
```bash
HOST_VAR_FILE_NAME="example_buttons.yml" molecule test