Replace goss tests with testinfra
This commit is contained in:
parent
b4695d7403
commit
97faa7429c
65 changed files with 163 additions and 1281 deletions
|
|
@ -81,6 +81,4 @@ provisioner:
|
|||
scenario:
|
||||
name: clients
|
||||
verifier:
|
||||
name: goss
|
||||
lint:
|
||||
name: yamllint
|
||||
name: testinfra
|
||||
|
|
|
|||
1
molecule/clients/tests
Symbolic link
1
molecule/clients/tests
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../generic_files/tests
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../generic_files/tests/test_all.yml
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../generic_files/tests/test_client.yml
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../generic_files/tests/test_client_restore.yml
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../generic_files/tests/test_server.yml
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
---
|
||||
# This is an example playbook to execute goss tests.
|
||||
# Tests need distributed to the appropriate ansible host/groups
|
||||
# prior to execution by `goss validate`.
|
||||
|
||||
- name: Verify all
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_all.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_all.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Verify clients
|
||||
hosts: all:!borgbackup_servers
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_client*.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_client*.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Verify backup servers
|
||||
hosts: borgbackup_servers
|
||||
become: true
|
||||
vars:
|
||||
goss_version: v0.3.2
|
||||
goss_arch: amd64
|
||||
goss_dst: /usr/local/bin/goss
|
||||
goss_sha256sum: 2f6727375db2ea0f81bee36e2c5be78ab5ab8d5981f632f761b25e4003e190ec
|
||||
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
|
||||
goss_test_directory: /tmp
|
||||
goss_format: documentation
|
||||
molecule_scenario_name: clients
|
||||
tasks:
|
||||
- name: Download and install Goss
|
||||
get_url:
|
||||
url: "{{ goss_url }}"
|
||||
dest: "{{ goss_dst }}"
|
||||
sha256sum: "{{ goss_sha256sum }}"
|
||||
mode: 0755
|
||||
register: download_goss
|
||||
until: download_goss is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Copy Goss tests to remote
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ goss_test_directory }}/{{ item | basename }}"
|
||||
with_fileglob:
|
||||
- "{{ lookup('env', 'MOLECULE_VERIFIER_TEST_DIRECTORY') }}/test_server*.yml"
|
||||
|
||||
- name: Register test files
|
||||
shell: "ls {{ goss_test_directory }}/test_server*.yml"
|
||||
register: test_files
|
||||
|
||||
- name: Execute Goss tests
|
||||
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
|
||||
register: test_results
|
||||
with_items: "{{ test_files.stdout_lines }}"
|
||||
|
||||
- name: Display details about the Goss results
|
||||
debug:
|
||||
msg: "{{ item.stdout_lines }}"
|
||||
with_items: "{{ test_results.results }}"
|
||||
|
||||
- name: Fail when tests fail
|
||||
fail:
|
||||
msg: "Goss failed to validate"
|
||||
when: item.rc != 0
|
||||
with_items: "{{ test_results.results }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue