feat: edit molecule test to make it more comprehensive
Some checks failed
test / Linting (push) Successful in 10s
test / Molecule tests (default, debian11) (push) Successful in 41s
test / Molecule tests (default, debian12) (push) Successful in 42s
test / Molecule tests (default, ubuntu2004) (push) Successful in 48s
test / Molecule tests (default, ubuntu2204) (push) Successful in 47s
test / Molecule tests (with_custom_packages, debian11) (push) Failing after 46s
test / Molecule tests (with_custom_packages, debian12) (push) Failing after 45s
test / Molecule tests (with_custom_packages, ubuntu2004) (push) Failing after 1m1s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Failing after 56s
Some checks failed
test / Linting (push) Successful in 10s
test / Molecule tests (default, debian11) (push) Successful in 41s
test / Molecule tests (default, debian12) (push) Successful in 42s
test / Molecule tests (default, ubuntu2004) (push) Successful in 48s
test / Molecule tests (default, ubuntu2204) (push) Successful in 47s
test / Molecule tests (with_custom_packages, debian11) (push) Failing after 46s
test / Molecule tests (with_custom_packages, debian12) (push) Failing after 45s
test / Molecule tests (with_custom_packages, ubuntu2004) (push) Failing after 1m1s
test / Molecule tests (with_custom_packages, ubuntu2204) (push) Failing after 56s
This commit is contained in:
parent
ad106d8648
commit
0a265c1135
@ -19,6 +19,9 @@
|
||||
- stat_etc_hosts.stat.gr_name == 'root'
|
||||
|
||||
- name: "Test: packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
wanted_up_to_date_list: ["pip", "docker"]
|
||||
wanted_out_of_date_list: ["vault-cli", "yamllint"]
|
||||
block:
|
||||
- name: "Get pip3 up-to-date packages"
|
||||
ansible.builtin.command: "pip3 list -u --format=json"
|
||||
@ -30,17 +33,22 @@
|
||||
changed_when: false
|
||||
register: pip_outdated_packages
|
||||
|
||||
- name: "Set fact for pip3 up-to-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_updated_list: "{{ pip3_updated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_updated_packages.stdout | from_json | selectattr('name', 'in', wanted_up_to_date_list) | list }}"
|
||||
|
||||
- name: "Set fact for pip3 out-of-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_outdated_list: "{{ pip3_outdated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_outdated_packages.stdout | from_json | selectattr('name', 'in', wanted_out_of_date_list) | list }}"
|
||||
|
||||
- name: "Verify packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'pip' in pip_up_to_date_list"
|
||||
- "'pip' not in pip_out_of_date_list"
|
||||
- "'vault-cli' not in pip_up_to_date_list"
|
||||
- "'vault-cli' not in pip_out_of_date_list"
|
||||
- "'yamllint' not in pip_up_to_date_list"
|
||||
- "'yamllint' not in pip_out_of_date_list"
|
||||
- "'docker' not in pip_up_to_date_list"
|
||||
- "'docker' not in pip_out_of_date_list"
|
||||
- "'pip' in pip3_updated_list"
|
||||
- "pip3_outdated_list is not defined"
|
||||
|
||||
- name: "Print up-to-date packages"
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ pip3_updated_list }}"
|
||||
|
@ -23,6 +23,9 @@
|
||||
- stat_etc_hosts.stat.gr_name == etc_hosts_group[(ansible_distribution|lower)]
|
||||
|
||||
- name: "Test: packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
wanted_up_to_date_list: ["pip", "docker"]
|
||||
wanted_out_of_date_list: ["vault-cli", "yamllint"]
|
||||
block:
|
||||
- name: "Get pip3 up-to-date packages"
|
||||
ansible.builtin.command: "pip3 list -u --format=json"
|
||||
@ -34,17 +37,22 @@
|
||||
changed_when: false
|
||||
register: pip_outdated_packages
|
||||
|
||||
- name: "Set fact for pip3 up-to-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_updated_list: "{{ pip3_updated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_updated_packages.stdout | from_json | selectattr('name', 'in', wanted_up_to_date_list) | list }}"
|
||||
|
||||
- name: "Set fact for pip3 out-of-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_outdated_list: "{{ pip3_outdated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_outdated_packages.stdout | from_json | selectattr('name', 'in', wanted_out_of_date_list) | list }}"
|
||||
|
||||
- name: "Verify packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'pip' in pip_up_to_date_list"
|
||||
- "'pip' not in pip_out_of_date_list"
|
||||
- "'vault-cli' not in pip_up_to_date_list"
|
||||
- "'vault-cli' not in pip_out_of_date_list"
|
||||
- "'yamllint' not in pip_up_to_date_list"
|
||||
- "'yamllint' not in pip_out_of_date_list"
|
||||
- "'docker' not in pip_up_to_date_list"
|
||||
- "'docker' not in pip_out_of_date_list"
|
||||
- "'pip' in pip3_updated_list"
|
||||
- "pip3_outdated_list is not defined"
|
||||
|
||||
- name: "Print up-to-date packages"
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ pip3_updated_list }}"
|
||||
|
@ -19,6 +19,9 @@
|
||||
- stat_etc_hosts.stat.gr_name == 'root'
|
||||
|
||||
- name: "Test: packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
wanted_up_to_date_list: ["pip", "docker"]
|
||||
wanted_out_of_date_list: ["vault-cli", "yamllint"]
|
||||
block:
|
||||
- name: "Get pip3 up-to-date packages"
|
||||
ansible.builtin.command: "pip3 list -u --format=json"
|
||||
@ -30,17 +33,22 @@
|
||||
changed_when: false
|
||||
register: pip_outdated_packages
|
||||
|
||||
- name: "Set fact for pip3 up-to-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_updated_list: "{{ pip3_updated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_updated_packages.stdout | from_json | selectattr('name', 'in', wanted_up_to_date_list) | list }}"
|
||||
|
||||
- name: "Set fact for pip3 out-of-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_outdated_list: "{{ pip3_outdated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_outdated_packages.stdout | from_json | selectattr('name', 'in', wanted_out_of_date_list) | list }}"
|
||||
|
||||
- name: "Verify packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'pip' in pip_up_to_date_list"
|
||||
- "'pip' not in pip_out_of_date_list"
|
||||
- "'vault-cli' not in pip_up_to_date_list"
|
||||
- "'vault-cli' in pip_out_of_date_list"
|
||||
- "'yamllint' not in pip_up_to_date_list"
|
||||
- "'yamllint' in pip_out_of_date_list"
|
||||
- "'docker' in pip_up_to_date_list"
|
||||
- "'docker' not in pip_out_of_date_list"
|
||||
- "'pip' in pip3_updated_list"
|
||||
- "not pip3_outdated_list"
|
||||
|
||||
- name: "Print up-to-date packages"
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ pip3_updated_list }}"
|
||||
|
@ -23,6 +23,9 @@
|
||||
- stat_etc_hosts.stat.gr_name == etc_hosts_group[(ansible_distribution|lower)]
|
||||
|
||||
- name: "Test: packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
wanted_up_to_date_list: ["pip", "docker"]
|
||||
wanted_out_of_date_list: ["vault-cli", "yamllint"]
|
||||
block:
|
||||
- name: "Get pip3 up-to-date packages"
|
||||
ansible.builtin.command: "pip3 list -u --format=json"
|
||||
@ -34,17 +37,32 @@
|
||||
changed_when: false
|
||||
register: pip_outdated_packages
|
||||
|
||||
- name: "Set fact for pip3 up-to-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_updated_list: "{{ pip3_updated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_updated_packages.stdout | from_json | selectattr('name', 'in', wanted_up_to_date_list) | list }}"
|
||||
|
||||
- name: "Set fact for pip3 out-of-date packages"
|
||||
ansible.builtin.set_fact:
|
||||
pip3_outdated_list: "{{ pip3_outdated_list | default({}) | combine({item.name: item.version}) }}"
|
||||
loop: "{{ pip_outdated_packages.stdout | from_json | selectattr('name', 'in', wanted_out_of_date_list) | list }}"
|
||||
|
||||
- name: "Verify packages pip, vault-cli, yamllint, docker"
|
||||
vars:
|
||||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}"
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'pip' in pip_up_to_date_list"
|
||||
- "'pip' not in pip_out_of_date_list"
|
||||
- "'vault-cli' not in pip_up_to_date_list"
|
||||
- "'vault-cli' in pip_out_of_date_list"
|
||||
- "'yamllint' not in pip_up_to_date_list"
|
||||
- "'yamllint' in pip_out_of_date_list"
|
||||
- "'docker' in pip_up_to_date_list"
|
||||
- "'docker' not in pip_out_of_date_list"
|
||||
- "'pip' in pip3_updated_list"
|
||||
- "'pip' not in pip3_outdated_list"
|
||||
- "'vault-cli' not in pip3_updated_list"
|
||||
- "'vault-cli' in pip3_outdated_list"
|
||||
- "'yamllint' not in pip3_updated_list"
|
||||
- "'yamllint' in pip3_outdated_list"
|
||||
- "'docker' in pip3_updated_list"
|
||||
- "'docker' not in pip3_outdated_list"
|
||||
|
||||
- name: "Print up-to-date packages"
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ pip3_updated_list }}"
|
||||
|
||||
- name: "Print out-of-date packages"
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ pip3_outdated_list }}"
|
||||
|
Loading…
Reference in New Issue
Block a user