Bitwarden tests and tasks fix

This commit is contained in:
David Stephens 2022-09-11 18:23:58 +01:00
parent 81da82de8f
commit 1759c79b67
5 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
bitwarden_enabled: true

View file

@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
bitwarden_enabled: false

View file

@ -0,0 +1,25 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml
- name: Get container state
docker_container_info:
name: "{{ bitwarden_container_name }}"
register: result
- name: Get container state
docker_container_info:
name: "{{ bitwarden_backup_container_name }}"
register: result_backup
- name: Check Bitwarden is running
assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
- result_backup.container['State']['Status'] == "running"
- result_backup.container['State']['Restarting'] == false

View file

@ -0,0 +1,25 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- include_vars:
file: ../../defaults/main.yml
- name: Try and stop and remove Bitwarden
docker_container:
name: "{{ bitwarden_container_name }}"
state: absent
register: result
- name: Try and stop and remove Bitwarden Backup
docker_container:
name: "{{ bitwarden_backup_container_name }}"
state: absent
register: result_backup
- name: Check Bitwarden is stopped
assert:
that:
- not result.changed
- not result_backup.changed

View file

@ -20,7 +20,7 @@
volumes:
- "{{ bitwarden_data_directory }}:/data:rw"
env:
SIGNUPS_ALLOWED: "{{ bitwarden_allow_signups }}"
SIGNUPS_ALLOWED: "{{ bitwarden_allow_signups | string }}"
ADMIN_TOKEN: "{{ bitwarden_admin_token }}"
LOG_FILE: "/data/bitwarden.log"
WEBSOCKET_ENABLED: "true"