-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·43 lines (34 loc) · 1.25 KB
/
entrypoint.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
echo "run_id: $RUN_ID in $ENVIRONMENT"
NOW=$(date +"%Y%m%d-%H%M%S")
if [ -z "${JM_HOME}" ]; then
JM_HOME=/opt/perftest
fi
JM_SCENARIOS=${JM_HOME}/scenarios
JM_REPORTS=${JM_HOME}/reports
JM_LOGS=${JM_HOME}/logs
mkdir -p ${JM_REPORTS} ${JM_LOGS}
SCENARIOFILE=${JM_SCENARIOS}/${TEST_SCENARIO}.jmx
REPORTFILE=${NOW}-perftest-${TEST_SCENARIO}-report.csv
LOGFILE=${JM_LOGS}/perftest-${TEST_SCENARIO}.log
# Run the test suite
jmeter -n -t ${SCENARIOFILE} -e -l "${REPORTFILE}" -o ${JM_REPORTS} -j ${LOGFILE} -f -Jenv="${ENVIRONMENT}"
test_exit_code=$?
# Publish the results into S3 so they can be displayed in the CDP Portal
if [ -n "$RESULTS_OUTPUT_S3_PATH" ]; then
# Copy the CSV report file and the generated report files to the S3 bucket
if [ -f "$JM_REPORTS/index.html" ]; then
aws --endpoint-url=$S3_ENDPOINT s3 cp "$REPORTFILE" "$RESULTS_OUTPUT_S3_PATH/$REPORTFILE"
aws --endpoint-url=$S3_ENDPOINT s3 cp "$JM_REPORTS" "$RESULTS_OUTPUT_S3_PATH" --recursive
if [ $? -eq 0 ]; then
echo "CSV report file and test results published to $RESULTS_OUTPUT_S3_PATH"
fi
else
echo "$JM_REPORTS/index.html is not found"
exit 1
fi
else
echo "RESULTS_OUTPUT_S3_PATH is not set"
exit 1
fi
exit $test_exit_code