Skip to content

Commit 09c6ac5

Browse files
committed
Fix CI/CD integration tests
* Split integ test execution vs report * Fix test status checks that determines if integration tests failed or not * Remove unused env var from CI/CD
1 parent 9d4a745 commit 09c6ac5

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

.circleci/config.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ jobs:
6565

6666
environment:
6767
KEYS_DIR: '/tmp/keys'
68-
DX_CLI_URL: 'https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.xz'
6968

7069
steps:
7170
- checkout
@@ -118,11 +117,18 @@ jobs:
118117
no_output_timeout: 270m
119118
environment:
120119
SALESFORCE_API_VERSION: '50.0'
121-
TEST_REPORTS_DIR_BASE: test_reports
122120
command: |
123121
sfdx config:set --global defaultusername=${HUB_SFDC_USER}
124122
./deploy_and_test_apex.sh
125123
124+
- run:
125+
name: Generate Test Report
126+
working_directory: test/integ
127+
environment:
128+
TEST_REPORTS_DIR_BASE: test_reports
129+
command: |
130+
./generate_test_report.sh
131+
126132
- store_test_results:
127133
path: test/integ/test_reports
128134

test/integ/deploy_and_test_apex.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,3 @@ do
115115
rm ${WEBHOOK_DATA_FILE}
116116
done
117117
done
118-
119-
jq \
120-
'. + { testResultsFilename: input_filename } | { status, message, result, stack, testResultsFilename }' \
121-
test-results-*.json \
122-
| jq -s > test-results.json
123-
124-
rm test-results-*.json
125-
126-
TEST_REPORTS_DIR="${TEST_REPORTS_DIR_BASE}/deploy_and_test"
127-
mkdir -p ${TEST_REPORTS_DIR}
128-
./format-as-junit.js > ${TEST_REPORTS_DIR}/results.xml
129-
130-
./detect-failed-tests.js

test/integ/detect-failed-tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const testResults = require("./test-results.json");
44

5-
const hadErrors = testResults.some((t) => t.status !== 0);
5+
const hadErrors = testResults.some((t) => !!t.status);
66
if (hadErrors) {
77
console.error("Errors while running integration tests");
88
process.exit(1);

test/integ/generate_test_report.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
# Abort the script if any of the commands below is not executed successfully
4+
set -e
5+
6+
jq \
7+
'. + { testResultsFilename: input_filename } | { status, message, result, stack, testResultsFilename }' \
8+
test-results-*.json \
9+
| jq -s > test-results.json
10+
11+
rm test-results-*.json
12+
13+
TEST_REPORTS_DIR="./${TEST_REPORTS_DIR_BASE}/deploy_and_test"
14+
mkdir -p ${TEST_REPORTS_DIR}
15+
./format-as-junit.js > ${TEST_REPORTS_DIR}/results.xml
16+
17+
./detect-failed-tests.js

0 commit comments

Comments
 (0)