finished up tests, should pass CI now

This commit is contained in:
Bertrand Lanson 2023-04-10 17:18:14 +02:00
parent 0723d42a73
commit c3f38cfbd9
4 changed files with 91 additions and 3 deletions

82
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,82 @@
---
stages:
- verify
- test-default
- test-with-custom-config
image:
name: registry.ednz.fr/forge/ansible-runner
variables:
ANSIBLE_HOST_KEY_CHECKING: 'false'
ANSIBLE_FORCE_COLOR: 'true'
ANSIBLE_PYTHON_INTERPRETER: /usr/bin/python3
DOCKER_AUTH_CONFIG: $CI_DOCKER_AUTH_CONFIG
.stage-test-default:
stage: test-default
.stage-test-with-custom-config:
stage: test-with-custom-config
.variables-ubuntu-2004:
variables:
MOLECULE_TEST_OS: "ubuntu2004"
.variables-ubuntu-2204:
variables:
MOLECULE_TEST_OS: "ubuntu2204"
.variables-debian-11:
variables:
MOLECULE_TEST_OS: "debian11"
.script-molecule-test-default:
script:
- molecule test
.script-molecule-test-with-custom-config:
script:
- molecule test -s with_custom_config
ansible-verify:
stage: verify
script:
- yamllint . -c .yamllint
- ansible-lint
ansible-test-ubuntu-2004-default:
extends:
- .stage-test-default
- .variables-ubuntu-2004
- .script-molecule-test-default
ansible-test-ubuntu-2204-default:
extends:
- .stage-test-default
- .variables-ubuntu-2204
- .script-molecule-test-default
ansible-test-debian-11-default:
extends:
- .stage-test-default
- .variables-debian-11
- .script-molecule-test-default
ansible-test-ubuntu-2004-with-custom-config:
extends:
- .stage-test-with-custom-config
- .variables-ubuntu-2004
- .script-molecule-test-with-custom-config
ansible-test-ubuntu-2204-with-custom-config:
extends:
- .stage-test-with-custom-config
- .variables-ubuntu-2204
- .script-molecule-test-with-custom-config
ansible-test-debian-11-with-custom-config:
extends:
- .stage-test-with-custom-config
- .variables-debian-11
- .script-molecule-test-with-custom-config

View File

@ -48,6 +48,11 @@ install_docker_users: [] #by default, set to []
``` ```
This variable is a list of users to add to the docker group, so that they can perform docker related tasks, without requiring privilege escalation. This variable is a list of users to add to the docker group, so that they can perform docker related tasks, without requiring privilege escalation.
```yaml
install_docker_daemon_options: {} # by default, set to {}
```
This variable defines the parameters to append to the daemon.json file (in `/etc/docker/daemon.json`). For more details, check out the [documentation](https://docs.docker.com/config/daemon/).
Dependencies Dependencies
------------ ------------

View File

@ -6,4 +6,5 @@ install_docker_compose_version: latest
install_docker_python_packages: true install_docker_python_packages: true
install_docker_python_packages_version: latest install_docker_python_packages_version: latest
install_docker_users: [] install_docker_users: []
install_docker_daemon_options: {} install_docker_daemon_options:
data-root: "/opt/docker"

View File

@ -23,7 +23,7 @@ def test_docker_daemon(host):
assert docker_daemon_file.user == "root" assert docker_daemon_file.user == "root"
assert docker_daemon_file.group =="root" assert docker_daemon_file.group =="root"
assert docker_daemon_file.mode == 0o644 assert docker_daemon_file.mode == 0o644
assert docker_daemon_file.contains("{}") assert docker_daemon_file.contains("\"data-root\": \"/opt/docker\"")
def test_docker_interaction(host): def test_docker_interaction(host):
"""Validate interaction with docker.""" """Validate interaction with docker."""