Skip to content

Commit f951c36

Browse files
committed
Fix the test to support multiple test contacts
1 parent a679339 commit f951c36

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

tests/report/reportportal/test.sh

+10-13
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,19 @@ rlJournalStart
189189
# Check the rarities in the test attributes/parameters
190190
if [[ $jq_element == attributes ]]; then
191191
key="contact"
192+
192193
value="$(yq -r ".\"$test_name\".$key" test.fmf)"
193194
if [[ $value != null ]]; then
194-
# TODO: Fix the test here! The output of yq is list of
195-
# contact in the case of multiple contacts (test==/bad)
196-
# and a string in a case when one contact is provided
197-
# for the test (test==/good). We must somehow handle
198-
# both situations.
199-
#
200-
# If yq returns list, we must check both contacts in the response JSON
201-
# If yq returns just a string value, we must check only one contact in the response JSON
195+
if [[ "$value" == *","* ]]; then
196+
# Get the contact items as CSV (separated by a comma)
197+
value="$(yq -r ". | @csv" <<< $value)"
198+
fi
202199
rlAssertGrep "$key" tmp_attributes.json -A1 > tmp_attributes_selection
203-
rlAssertGrep "$value" tmp_attributes_selection
200+
201+
IFS=, read -r -a contact_items <<< "$value"
202+
for contact_item in "${contact_items[@]}"; do
203+
rlAssertGrep "$contact_item" tmp_attributes_selection
204+
done
204205
else
205206
rlAssertNotGrep "$key" tmp_attributes.json
206207
fi
@@ -209,10 +210,6 @@ rlJournalStart
209210
rlAssertNotGrep "$key" tmp_attributes.json
210211
fi
211212

212-
# REMOVE ME: just for testing
213-
#echo "EXITING OMG"
214-
#exit 99
215-
216213
rm tmp_attributes*
217214
done
218215

0 commit comments

Comments
 (0)