Skip to content

Commit 2bfdba6

Browse files
committed
[common] Update the CR tests to mark one as optional
Only include the test_id if the condition_type is defined. Set a default for the condition_type so that the task name is rendered correctly in output plugins.
1 parent 9ccec7f commit 2bfdba6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

roles/common/tasks/cr_tests.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@
1010
failed_when:
1111
- result.rc != 0
1212

13-
- name: Verify that a CR is ready {{ common_cr_ready_test_id }}
13+
# This is added so that the task name will be rendered correctly
14+
# If item.condition_type is used and it doesn't exist, then the
15+
# literal template text will appear as the task name
16+
# e.g. "Verify that the {{ item.kind }} {{ item.name }} CR is {{ item.condition_type }}"
17+
- name: Set the condition type
18+
ansible.builtin.set_fact:
19+
condition_type: "{{ item.condition_type if item.condition_type is defined else '' }}"
20+
21+
- name: |
22+
Verify that the {{ item.kind }} {{ item.name }} CR is {{ condition_type }}
23+
{{ common_cr_ready_test_id if condition_type | length > 0 }}
1424
ansible.builtin.command:
1525
cmd: |
16-
oc get {{ item.kind }} {{ item.name }} -o jsonpath='{.status.conditions[?(@.type=="{{ item.condition_type }}")].status}{"\n"}'
26+
oc get {{ item.kind }} {{ item.name }} -o jsonpath='{.status.conditions[?(@.type=="{{ condition_type }}")].status}{"\n"}'
1727
register: result
1828
changed_when: false
1929
failed_when:
2030
- result.stdout != "True"
21-
when:
22-
- common_cr_ready_test_id is defined
23-
- item.condition_type is defined

0 commit comments

Comments
 (0)