Skip to content

Commit

Permalink
enh(tests): First attempt to link robot tests with xRay tests to disp…
Browse files Browse the repository at this point in the history
…lay the status of automated tests (#1167)

REFS: MON-24549

---------

Co-authored-by: sfarouq-ext <sfarouq-ext@github.com>
  • Loading branch information
sfarouq-ext and sfarouq-ext authored Mar 29, 2024
1 parent 09fa470 commit fad99a4
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/robot-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ jobs:
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
collect_s3_access_key: ${{ secrets.COLLECT_S3_ACCESS_KEY }}
collect_s3_secret_key: ${{ secrets.COLLECT_S3_SECRET_KEY }}
xray_client_id: ${{ secrets.XRAY_CLIENT_ID }}
xray_client_secret: ${{ secrets.XRAY_CLIENT_SECRET }}

deliver-rpm:
if: ${{ contains(fromJson('["unstable"]'), needs.get-version.outputs.stability) }}
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/robot-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ on:
required: true
collect_s3_secret_key:
required: true

xray_client_id:
required: true
xray_client_secret:
required: true

jobs:
test-image-to-cache:
Expand Down Expand Up @@ -146,6 +149,18 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.collect_s3_access_key }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.collect_s3_secret_key }}

- name: Generate Xray Token
id: generate-xray-token
run: |
token_response=$(curl -H "Content-Type: application/json" -X POST --data "{\"client_id\": \"${{ secrets.XRAY_CLIENT_ID }}\", \"client_secret\": \"${{ secrets.XRAY_CLIENT_SECRET }}\"}" "https://xray.cloud.getxray.app/api/v1/authenticate")
xray_token=$(echo "$token_response" | sed -n 's/.*"\(.*\)".*/\1/p')
echo "xray_token=$xray_token" >> $GITHUB_OUTPUT
shell: bash

- name: Send report to xrays
run: |
curl -H "Content-Type: multipart/form-data" -X POST -F info=@tests/issueFields.json -F results=@tests/output.xml -F testInfo=@tests/testIssueFields.json -H "Authorization: Bearer ${{ steps.generate-xray-token.outputs.xray_token }}" https://xray.cloud.getxray.app/api/v2/import/execution/robot/multipart
- name: Move reports
if: ${{ failure() }}
run: |
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions tests/issueFields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"fields": {
"project": {
"id": "11100",
"key": "MON"
},
"summary": "Brand new Test execution",
"issuetype": {
"id": "10271",
"name": "Test Execution"
},
"components": [
{
"name": "centreon-collect"
}
]
},
"xrayFields": {
"testPlanKey": "MON-35339"
}
}
11 changes: 11 additions & 0 deletions tests/testIssueFields.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"fields": {
"project": {
"id": "11100"
},
"labels": [
"Server",
"Robot"
]
}
}

0 comments on commit fad99a4

Please sign in to comment.