Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple test contacts in the ReportPortal plugin #3412

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ method are now executed in the exact order as listed in the config
file. This fixes a problem which has been introduced in the recent
``fmf`` update.

The :ref:`/plugins/report/reportportal` plugin now exports all
test contact information, rather than just the first contact
instance.


tmt-1.40.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 4 additions & 2 deletions tests/report/reportportal/data/test.fmf
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/bad:
summary: Failing test
contact: [email protected]
contact:
- [email protected]
- [email protected]
test: echo "Something bad happened!"; false

/good:
summary: Passing test
contact: tester_2@redhat.com
contact: tester3@redhat.com
test: echo "Everything's fine!"
id: 63f26fb7-69c4-4781-a06e-098e2b58129f

Expand Down
11 changes: 10 additions & 1 deletion tests/report/reportportal/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,19 @@ rlJournalStart
# Check the rarities in the test attributes/parameters
if [[ $jq_element == attributes ]]; then
key="contact"

value="$(yq -r ".\"$test_name\".$key" test.fmf)"
if [[ $value != null ]]; then
if [[ "$value" == *","* ]]; then
# Get the contact items as CSV (separated by a comma)
value="$(yq -r ". | @csv" <<< $value)"
fi
rlAssertGrep "$key" tmp_attributes.json -A1 > tmp_attributes_selection
rlAssertGrep "$value" tmp_attributes_selection

IFS=, read -r -a contact_items <<< "$value"
for contact_item in "${contact_items[@]}"; do
rlAssertGrep "$contact_item" tmp_attributes_selection
done
else
rlAssertNotGrep "$key" tmp_attributes.json
fi
Expand Down
3 changes: 2 additions & 1 deletion tmt/steps/report/reportportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ def execute_rp_import(self) -> None:
if not test_name:
test_name = test.name
if test.contact:
item_attributes.append({"key": "contact", "value": test.contact[0]})
item_attributes += [
{'key': 'contact', 'value': contact} for contact in test.contact]
if test.summary:
test_description = test.summary
if test.web_link():
Expand Down
Loading