Skip to content

Commit 03ed468

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 207992e commit 03ed468

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

roles/common/tasks/cr_tests.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@
99
failed_when:
1010
- result.rc != 0
1111

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

0 commit comments

Comments
 (0)