Skip to content

Commit a8067c6

Browse files
committed
[common] Update the optional CR status test
1 parent e7dbdd2 commit a8067c6

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

roles/common/tasks/cr_tests.yml

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

13-
# This is added so that the test is not included when it shouldn't be
14-
# If the when is added to the test task, the resulting task name in
15-
# XML is "verify_that_the_item_kind__item_name_cr_is_item_condition"
16-
# Which might be okay, if polarion ignores the unknown testcases
17-
# If polarion is ignoring the unknown testcases, then we don't need to
18-
# mark anything with a test prefix
19-
- name: Determine whether to mark the CR ready test as a test
13+
# This is added so that the test is not marked when it shouldn't be
14+
# If the item.condition_type is referenced in the TEST task, without
15+
# being defined, the resulting task name in XML is
16+
# "verify_that_the_item_kind_item_name_cr_is_item_condition_type"
17+
- name: Set the condition type
2018
ansible.builtin.set_fact:
21-
run_cr_ready_test: true
22-
when:
23-
- common_cr_ready_test_id is defined
24-
- item.condition_type is defined
19+
condition_type: "{{ item.condition_type if item.condition_type is defined else '' }}"
2520

2621
- name: |
27-
{{ 'TEST' if run_cr_ready_test | bool }} Verify that the {{ item.kind }} {{ item.name }} CR is {{ item.condition_type }}
28-
{{ common_cr_ready_test_id }}
22+
{{ 'TEST' if condition_type | length > 0 }} Verify that the {{ item.kind }} {{ item.name }} CR is {{ condition_type }}
23+
{{ common_cr_ready_test_id if condition_type | length > 0 }}
2924
ansible.builtin.command:
3025
cmd: |
31-
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"}'
3227
register: result
3328
changed_when: false
3429
failed_when:

0 commit comments

Comments
 (0)