Skip to content

Commit 4797f11

Browse files
fix(execution-spec-tests-execute.yaml)
1 parent f467aec commit 4797f11

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

playbooks/dev/execution-spec-tests-execute.yaml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -175,33 +175,33 @@ tasks:
175175
176176
cp report.json ${ASSERTOOR_RESULT_DIR}/report.json
177177
cp report.html ${ASSERTOOR_RESULT_DIR}/report.html
178+
mkdir -p ${ASSERTOOR_RESULT_DIR}/assets
179+
curl -o ${ASSERTOOR_RESULT_DIR}/assets/style.css https://raw.githubusercontent.com/noku-team/assertoor/refs/heads/master/res/execution-spec-tests-styles.css
178180
179181
REPORT_JSON=$(cat report.json | jq -c '[.tests[] | {"nodeid": .nodeid, "outcome": .outcome, "setupDuration": .setup.duration, "callDuration": .call.duration, "teardownDuration": .teardown.duration}]')
182+
TOTAL_TESTS=$(echo "$REPORT_JSON" | jq '. | length')
183+
PASSED_TESTS=$(echo "$REPORT_JSON" | jq '[.[] | select(.outcome == "passed")] | length')
184+
echo "Total tests: $TOTAL_TESTS"
185+
echo "Passed tests: $PASSED_TESTS"
180186
181-
echo "::set-output-json reportJSON ${REPORT_JSON}"
187+
# Check if tests passed
188+
echo "::set-output passedTests ${PASSED_TESTS}"
189+
echo "::set-output totalTests ${TOTAL_TESTS}"
182190
183191
exit 0
184-
- name: run_task_matrix
185-
title: "Show test results"
186-
configVars:
187-
matrixValues: "tasks.execute.outputs.reportJSON"
192+
193+
- name: run_shell
194+
title: "Check test results (${{tasks.execute.outputs.passedTests}} / ${{tasks.execute.outputs.totalTests}} passed)"
195+
id: check
196+
if: runTests
188197
config:
189-
runConcurrent: true
190-
matrixVar: "testResult"
191-
task:
192-
name: run_shell
193-
title: "${{testResult.nodeid}}"
194-
config:
195-
shell: bash
196-
envVars:
197-
TEST_RESULT: testResult
198-
command: |
199-
DURATION_SECONDS=$(echo $TEST_RESULT | jq -r '(.setup.duration // 0) + (.call.duration // 0) + (.teardown.duration // 0)')
200-
echo "::set-output-json customRunTimeSeconds ${DURATION_SECONDS}"
201-
echo "::set-output-json execTestResult ${TEST_RESULT}"
202-
if $(echo $TEST_RESULT | jq -e '.outcome == "passed"') ; then
203-
echo "Test passed"
204-
else
205-
echo "Test failed"
206-
exit 1
207-
fi
198+
shell: bash
199+
envVars:
200+
passedTests: "tasks.execute.outputs.passedTests"
201+
totalTests: "tasks.execute.outputs.totalTests"
202+
command: |
203+
set -e
204+
if [ "${passedTests}" != "${totalTests}" ]; then
205+
echo "Some tests failed, see report.html in the task above for details"
206+
exit 1
207+
fi

0 commit comments

Comments
 (0)