feat(test): add custom config vagrant tests

This commit is contained in:
Bertrand Lanson 2023-12-12 20:45:25 +01:00
parent 65dfc18524
commit 18f875f585
7 changed files with 116 additions and 1 deletions

View File

@ -20,7 +20,7 @@ deploy_gitea_runner_config:
fetch_interval: 2s
labels: ["debian-bullseye:docker://node:16-bullseye"]
cache:
enabled: false
enabled: true
dir: "/cache" # this HAS TO BE /cache if deploy_gitea_runner_deploy_method is docker
host: 127.0.0.1
port: 9898

View File

@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include ednxzu.deploy_gitea_runner"
ansible.builtin.include_role:
name: "ednxzu.deploy_gitea_runner"

View File

@ -0,0 +1,36 @@
---
deploy_gitea_runner_version: latest
deploy_gitea_runner_deploy_method: docker # deployment method, either host or docker.
deploy_gitea_runner_directory: /opt/gitea-actions
deploy_gitea_runner_timezone: "Europe/Paris"
deploy_gitea_runner_register: false
deploy_gitea_runner_start_service: false
deploy_gitea_runner_server_url: https://git.example.com
deploy_gitea_runner_server_token: ""
deploy_gitea_runner_name: gitea-runner
deploy_gitea_runner_config:
log:
level: info
runner:
file: ".runner" # this HAS TO BE .runner if deploy_gitea_runner_deploy_method is docker
capacity: 1
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels: ["debian-bullseye:docker://node:16-bullseye"]
cache:
enabled: true
dir: "/cache" # this HAS TO BE /cache if deploy_gitea_runner_deploy_method is docker
host: 127.0.0.1
port: 9898
external_server:
container:
network: ""
privileged: false
options: ""
workdir_parent:
valid_volumes: []
docker_host: ""
host:
workdir_parent:

View File

@ -0,0 +1,35 @@
---
dependency:
name: galaxy
options:
requirements-file: ./requirements.yml
driver:
name: vagrant
provider:
name: libvirt
platforms:
- name: instance
box: generic/${MOLECULE_TEST_OS}
cpus: 4
memory: 4096
provisioner:
name: ansible
config_options:
defaults:
remote_tmp: /tmp/.ansible
verifier:
name: ansible
scenario:
name: with_docker_host_vagrant
test_sequence:
- dependency
- cleanup
- destroy
- syntax
- create
- prepare
- converge
- idempotence
- verify
- cleanup
- destroy

View File

@ -0,0 +1,10 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: "Include ednxzu.install_docker"
ansible.builtin.include_role:
name: ednxzu.install_docker
vars:
install_docker_python_packages: true

View File

@ -0,0 +1,6 @@
---
# requirements file for molecule
roles:
- name: ednxzu.manage_repositories
- name: ednxzu.manage_apt_packages
- name: ednxzu.docker_systemd_service

View File

@ -0,0 +1,20 @@
---
- name: Verify
hosts: all
gather_facts: true
become: true
tasks:
- name: "Test: file /etc/hosts"
block:
- name: "Stat file /etc/hosts"
ansible.builtin.stat:
path: "/etc/hosts"
register: stat_etc_hosts
- name: "Verify file /etc/hosts"
ansible.builtin.assert:
that:
- stat_etc_hosts.stat.exists
- stat_etc_hosts.stat.isreg
- stat_etc_hosts.stat.pw_name == 'root'
- stat_etc_hosts.stat.gr_name == 'root'