mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
|
---
|
||
|
- when: sops_installed
|
||
|
block:
|
||
|
|
||
|
- name: Test lookup with missing file
|
||
|
set_fact:
|
||
|
sops_file_does_not_exists: "{{ lookup('community.general.sops', 'file-does-not-exists.sops.yml') }}"
|
||
|
ignore_errors: yes
|
||
|
register: sops_lookup_missing_file
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "sops_lookup_missing_file is failed"
|
||
|
- "'could not locate file in lookup: file-does-not-exists.sops.yml' in sops_lookup_missing_file.msg"
|
||
|
|
||
|
- name: Test lookup of non-sops file
|
||
|
set_fact:
|
||
|
sops_wrong_file: "{{ lookup('community.general.sops', 'wrong.yaml') }}"
|
||
|
ignore_errors: yes
|
||
|
register: sops_lookup_wrong_file
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "sops_lookup_wrong_file is failed"
|
||
|
- "'sops metadata not found' in sops_lookup_wrong_file.msg"
|
||
|
|
||
|
- name: Test simple lookup
|
||
|
set_fact:
|
||
|
sops_success: "{{ lookup('community.general.sops', 'simple.sops.yaml') }}"
|
||
|
ignore_errors: yes
|
||
|
register: sops_lookup_simple
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "sops_lookup_simple is success"
|
||
|
- "sops_success == 'foo: bar'"
|