Skip to content

Commit 8b940ca

Browse files
authored
chore(tests): smoke test refactor (#1741)
fix(tests): refactored smoke test jobs and steps Signed-off-by: rostalan <rlan@redhat.com> Assisted-by: Cursor
1 parent b5a0915 commit 8b940ca

5 files changed

Lines changed: 159 additions & 284 deletions

File tree

.github/workflows/pr-actions.yaml

Lines changed: 42 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
contains(github.event.comment.body, '/smoketest'))
1818
1919
outputs:
20-
command_name: ${{ steps.extract.outputs.command_name }}
21-
error_message: ${{ steps.extract.outputs.error_message }}
20+
command-name: ${{ steps.extract.outputs.command-name }}
21+
error-message: ${{ steps.extract.outputs.error-message }}
2222
steps:
2323
- name: Extract command from comment
2424
id: extract
@@ -35,8 +35,8 @@ jobs:
3535
3636
if (matchingCommands.length > 1) {
3737
const errorMsg = `Multiple commands found in comment: ${matchingCommands.join(', ')}. Please use only one command per comment.`;
38-
core.setOutput('error_message', errorMsg);
39-
core.setOutput('command_name', '');
38+
core.setOutput('error-message', errorMsg);
39+
core.setOutput('command-name', '');
4040
core.setFailed(errorMsg);
4141
return;
4242
}
@@ -51,8 +51,8 @@ jobs:
5151
}
5252
5353
const firstMatching = matchingCommands[0] || '';
54-
core.setOutput('command_name', firstMatching.startsWith('/') ? firstMatching.slice(1) : firstMatching);
55-
core.setOutput('error_message', '');
54+
core.setOutput('command-name', firstMatching.startsWith('/') ? firstMatching.slice(1) : firstMatching);
55+
core.setOutput('error-message', '');
5656
5757
add_error_comment:
5858
needs:
@@ -65,13 +65,13 @@ jobs:
6565
permissions:
6666
pull-requests: write
6767

68-
if: always() && needs.parse.outputs.error_message != ''
68+
if: always() && needs.parse.outputs.error-message != ''
6969
runs-on: ubuntu-latest
7070
steps:
7171
- name: Add error comment
7272
uses: actions/github-script@v7
7373
env:
74-
INPUT_ERROR_MESSAGE: ${{ needs.parse.outputs.error_message }}
74+
INPUT_ERROR_MESSAGE: ${{ needs.parse.outputs.error-message }}
7575
with:
7676
script: |
7777
const errorMessage = core.getInput('error_message');
@@ -93,7 +93,7 @@ jobs:
9393
group: prepare-${{ github.ref_name }}-${{ github.event.issue.number }}
9494
cancel-in-progress: false
9595

96-
if: needs.parse.outputs.command_name != ''
96+
if: needs.parse.outputs.command-name != ''
9797
outputs:
9898
target-branch: ${{ steps.get-branch.outputs.target-branch }}
9999
overlay-branch: ${{ steps.get-branch.outputs.overlay-branch }}
@@ -110,7 +110,7 @@ jobs:
110110
id: get-branch
111111
uses: actions/github-script@v7
112112
env:
113-
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command_name }}
113+
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command-name }}
114114
with:
115115
script: |
116116
const currentPullRequest = await github.rest.pulls.get({
@@ -179,7 +179,7 @@ jobs:
179179
group: export-${{ github.ref_name }}-${{ github.event.issue.number }}
180180
cancel-in-progress: true
181181

182-
if: needs.parse.outputs.command_name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
182+
if: needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
183183

184184
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/export-workspaces-as-dynamic.yaml@main
185185
with:
@@ -200,21 +200,21 @@ jobs:
200200
packages: write
201201
id-token: write
202202

203-
uploadPublishedExportsArtifact:
204-
name: Upload published-exports artifact
203+
uploadArtifacts:
204+
name: Upload Artifacts
205205
needs:
206206
- parse
207207
- prepare
208208
- export
209+
if: always() && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.pr-number != ''
209210

210211
concurrency:
211-
group: uploadPublishedExportsArtifact-${{ github.ref_name }}-${{ github.event.issue.number }}
212+
group: uploadArtifacts-${{ github.ref_name }}-${{ github.event.issue.number }}
212213
cancel-in-progress: false
213214

214-
if: needs.parse.outputs.command_name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != '' && needs.export.outputs.published-exports != ''
215215
runs-on: ubuntu-latest
216216
steps:
217-
- name: Write and stage meta.json
217+
- name: Create meta.json with workspace and PR information
218218
env:
219219
WORKSPACE: ${{ needs.prepare.outputs.workspace }}
220220
OVERLAY_BRANCH: ${{ needs.prepare.outputs.overlay-branch }}
@@ -223,58 +223,36 @@ jobs:
223223
PR_NUMBER: ${{ needs.prepare.outputs.pr-number }}
224224
TARGET_BRANCH: ${{ needs.prepare.outputs.target-branch }}
225225
run: |
226-
mkdir -p published-exports
227-
cat > published-exports/meta.json <<EOF
226+
mkdir -p context
227+
cat > context/meta.json <<EOF
228228
{"workspace":"${WORKSPACE}","overlayBranch":"${OVERLAY_BRANCH}","overlayRepo":"${OVERLAY_REPO}","overlayCommit":"${OVERLAY_COMMIT}","pr":${PR_NUMBER},"targetBranch":"${TARGET_BRANCH}"}
229229
EOF
230+
230231
- name: Stage published exports content
232+
if: needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.workspace != '' && needs.export.outputs.published-exports != ''
231233
env:
232234
PUBLISHED_EXPORTS: ${{ needs.export.outputs.published-exports }}
233235
run: |
236+
mkdir -p published-exports
237+
cp context/meta.json published-exports/
234238
printf "%s\n" "$PUBLISHED_EXPORTS" > published-exports/published-exports.txt
235-
- name: Upload published-exports artifact
236-
uses: actions/upload-artifact@v4
237-
with:
238-
name: published-exports-pr-${{ needs.prepare.outputs.pr-number }}
239-
path: published-exports/
240-
if-no-files-found: error
241-
retention-days: 7
239+
242240
- name: Upload context artifact
243241
uses: actions/upload-artifact@v4
244242
with:
245243
name: context-${{ github.run_id }}
246-
path: published-exports/meta.json
244+
path: context/meta.json
247245
if-no-files-found: error
248246
retention-days: 1
249247

250-
create_test_context:
251-
name: Create Smoke Test Context
252-
needs:
253-
- parse
254-
- prepare
255-
if: needs.parse.outputs.command_name == 'smoketest' && needs.prepare.outputs.pr-number != ''
256-
runs-on: ubuntu-latest
257-
steps:
258-
- name: Write meta.json for smoke test context
259-
env:
260-
WORKSPACE: ${{ needs.prepare.outputs.workspace }}
261-
OVERLAY_BRANCH: ${{ needs.prepare.outputs.overlay-branch }}
262-
OVERLAY_REPO: ${{ needs.prepare.outputs.overlay-repo }}
263-
OVERLAY_COMMIT: ${{ needs.prepare.outputs.overlay-commit }}
264-
PR_NUMBER: ${{ needs.prepare.outputs.pr-number }}
265-
TARGET_BRANCH: ${{ needs.prepare.outputs.target-branch }}
266-
run: |
267-
mkdir -p context
268-
cat > context/meta.json <<EOF
269-
{"workspace":"${WORKSPACE}","overlayBranch":"${OVERLAY_BRANCH}","overlayRepo":"${OVERLAY_REPO}","overlayCommit":"${OVERLAY_COMMIT}","pr":${PR_NUMBER},"targetBranch":"${TARGET_BRANCH}"}
270-
EOF
271-
- name: Upload smoke-test-context artifact
248+
- name: Upload published-exports artifact
249+
if: needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.workspace != '' && needs.export.outputs.published-exports != ''
272250
uses: actions/upload-artifact@v4
273251
with:
274-
name: context-${{ github.run_id }}
275-
path: context/meta.json
252+
name: published-exports-pr-${{ needs.prepare.outputs.pr-number }}
253+
path: published-exports/
276254
if-no-files-found: error
277-
retention-days: 1
255+
retention-days: 7
278256

279257
checkBackstageCompatibility:
280258
name: Check workspace backstage compatibility
@@ -286,7 +264,7 @@ jobs:
286264
group: checkBackstageCompatibility-${{ github.ref_name }}-${{ github.event.issue.number }}
287265
cancel-in-progress: true
288266

289-
if: needs.parse.outputs.command_name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
267+
if: needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
290268

291269
uses: redhat-developer/rhdh-plugin-export-utils/.github/workflows/check-backstage-compatibility.yaml@main
292270
with:
@@ -310,7 +288,7 @@ jobs:
310288
statuses: write
311289
pull-requests: write
312290

313-
if: always() && needs.parse.outputs.command_name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
291+
if: always() && needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
314292
runs-on: ubuntu-latest
315293
steps:
316294
- name: Download compatibility report
@@ -329,7 +307,7 @@ jobs:
329307
INPUT_WORKSPACE: ${{ needs.prepare.outputs.workspace }}
330308
INPUT_PUBLISHED_EXPORTS: ${{ needs.export.outputs.published-exports }}
331309
INPUT_FAILED_EXPORTS: ${{ needs.export.outputs.failed-exports }}
332-
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command_name }}
310+
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command-name }}
333311
INPUT_METADATA_VALIDATION_PASSED: ${{ needs.export.outputs.metadata-validation-passed }}
334312
INPUT_METADATA_VALIDATION_ERRORS: ${{ needs.export.outputs.metadata-validation-errors }}
335313
INPUT_METADATA_VALIDATION_ERROR_COUNT: ${{ needs.export.outputs.metadata-validation-error-count }}
@@ -458,11 +436,11 @@ jobs:
458436
runs-on: ubuntu-latest
459437

460438
steps:
461-
- name: Add success comment
439+
- name: Report skipped command
462440
uses: actions/github-script@v7
463441
env:
464442
INPUT_OVERLAY_COMMIT: ${{ needs.prepare.outputs.overlay-commit }}
465-
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command_name }}
443+
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command-name }}
466444

467445
with:
468446
script: |
@@ -490,33 +468,6 @@ jobs:
490468
body: body
491469
})
492470
493-
upload_no_workspace_context:
494-
needs:
495-
- parse
496-
- prepare
497-
if: always() && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace == ''
498-
runs-on: ubuntu-latest
499-
steps:
500-
- name: Write and upload context artifact
501-
env:
502-
OVERLAY_BRANCH: ${{ needs.prepare.outputs.overlay-branch }}
503-
OVERLAY_REPO: ${{ needs.prepare.outputs.overlay-repo }}
504-
OVERLAY_COMMIT: ${{ needs.prepare.outputs.overlay-commit }}
505-
PR_NUMBER: ${{ needs.prepare.outputs.pr-number }}
506-
TARGET_BRANCH: ${{ needs.prepare.outputs.target-branch }}
507-
run: |
508-
mkdir -p context
509-
cat > context/meta.json <<EOF
510-
{"workspace":"","overlayBranch":"${OVERLAY_BRANCH}","overlayRepo":"${OVERLAY_REPO}","overlayCommit":"${OVERLAY_COMMIT}","pr":${PR_NUMBER},"targetBranch":"${TARGET_BRANCH}"}
511-
EOF
512-
- name: Upload context artifact
513-
uses: actions/upload-artifact@v4
514-
with:
515-
name: context-${{ github.run_id }}
516-
path: context/meta.json
517-
if-no-files-found: error
518-
retention-days: 1
519-
520471
checkPRUpToDate:
521472
name: Checks whether the PR is up-to-date with versions.json
522473
needs:
@@ -531,7 +482,7 @@ jobs:
531482
statuses: write
532483
pull-requests: write
533484

534-
if: always() && needs.parse.outputs.command_name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
485+
if: always() && needs.parse.outputs.command-name == 'publish' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
535486
runs-on: ubuntu-latest
536487
steps:
537488
- name: Add update check comment
@@ -584,7 +535,7 @@ jobs:
584535

585536
if (sourceContent !== targetContent) {
586537
core.setFailed(`PR not up-to-date with the release branch`);
587-
const body = `The \`versions.json\` file in your PR doesn't match the one in release branch #${prBranch}\nTry updating it by adding the \`/update-versions\` PR comment.`;
538+
const body = `The \`versions.json\` file in your PR doesn't match the one in release branch ${releaseBranch}\nTry updating it by adding the \`/update-versions\` PR comment.`;
588539
await github.rest.issues.createComment({
589540
issue_number: context.issue.number,
590541
owner: context.repo.owner,
@@ -603,7 +554,7 @@ jobs:
603554
group: updatePRWithVersions-${{ github.ref_name }}-${{ github.event.issue.number }}
604555
cancel-in-progress: true
605556

606-
if: needs.parse.outputs.command_name == 'update-versions'
557+
if: needs.parse.outputs.command-name == 'update-versions'
607558
uses: ./.github/workflows/update-prs-with-release-branch-commits.yaml
608559
with:
609560
force: true
@@ -627,14 +578,14 @@ jobs:
627578
statuses: write
628579
pull-requests: write
629580

630-
if: always() && needs.parse.outputs.command_name == 'update-versions' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
581+
if: always() && needs.parse.outputs.command-name == 'update-versions' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
631582
runs-on: ubuntu-latest
632583
steps:
633584
- name: Add completion comment
634585
uses: actions/github-script@v7
635586
env:
636587
INPUT_OVERLAY_COMMIT: ${{ needs.prepare.outputs.overlay-commit }}
637-
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command_name }}
588+
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command-name }}
638589

639590
with:
640591
script: |
@@ -681,7 +632,7 @@ jobs:
681632
group: updatePRWithCommit-${{ github.ref_name }}-${{ github.event.issue.number }}
682633
cancel-in-progress: true
683634

684-
if: needs.parse.outputs.command_name == 'update-commit'
635+
if: needs.parse.outputs.command-name == 'update-commit'
685636
uses: ./.github/workflows/update-plugins-repo-refs.yaml
686637
with:
687638
single-branch: ${{ needs.prepare.outputs.target-branch }}
@@ -708,14 +659,14 @@ jobs:
708659
statuses: write
709660
pull-requests: write
710661

711-
if: always() && needs.parse.outputs.command_name == 'update-commit' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
662+
if: always() && needs.parse.outputs.command-name == 'update-commit' && needs.prepare.outputs.overlay-branch != '' && needs.prepare.outputs.workspace != ''
712663
runs-on: ubuntu-latest
713664
steps:
714665
- name: Add completion comment
715666
uses: actions/github-script@v7
716667
env:
717668
INPUT_OVERLAY_COMMIT: ${{ needs.prepare.outputs.overlay-commit }}
718-
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command_name }}
669+
INPUT_COMMAND_NAME: ${{ needs.parse.outputs.command-name }}
719670

720671
with:
721672
script: |

.github/workflows/run-workspace-smoke-tests.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
username: ${{ github.actor }}
4444
password: ${{ secrets.GITHUB_TOKEN }}
4545

46-
- name: Start RHDH with Layered Test Config
46+
- name: Start RHDH with test plugins config
4747
run: |
4848
set -euo pipefail
4949
ls -la ./artifacts/ || true
@@ -117,16 +117,12 @@ jobs:
117117
echo "RHDH did not become ready in time."
118118
exit 1
119119
120-
- name: Check plugin installation folder structure
120+
- name: List installed plugins
121121
run: docker exec rhdh ls -l /opt/app-root/src/dynamic-plugins-root
122122

123-
- name: Check contents of app-config.dynamic-plugins.yaml
123+
- name: Print generated dynamic plugins config
124124
run: docker exec rhdh cat /opt/app-root/src/dynamic-plugins-root/app-config.dynamic-plugins.yaml
125125

126-
- name: Basic health check
127-
run: |
128-
curl -fsS http://localhost:7007/health
129-
130126
- name: Verify plugin loading
131127
id: collect-results
132128
run: |
@@ -201,7 +197,7 @@ jobs:
201197
fi
202198
echo "EOF" >> "$GITHUB_OUTPUT"
203199
204-
- name: Container logs
200+
- name: Print container logs
205201
if: always()
206202
run: docker logs rhdh || true
207203

0 commit comments

Comments
 (0)