forked from aws-samples/aws-serverless-ecommerce-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests-e2e
executable file
·53 lines (42 loc) · 1.13 KB
/
tests-e2e
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
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
ROOT=${ROOT:-$(pwd)}
tests_dir=${ROOT}/shared/tests/e2e
reports_dir=${REPORTS_DIR:-$ROOT/reports}
display_usage () {
echo "Usage: $0 TYPE SERVICE"
}
# Check for quiet mode
if [ ! -z $QUIET ]; then
export OUTPUT_FILE=$(mktemp)
exec 5>&1 6>&2 1>$OUTPUT_FILE 2>&1
fi
cleanup () {
CODE=$?
if [ ! -z $QUIET ]; then
if [ ! $CODE -eq 0 ]; then
cat $OUTPUT_FILE >&5
fi
rm $OUTPUT_FILE
fi
}
trap cleanup EXIT
# End-to-end tests
tests_e2e () {
# Skip tests on environment where we shouldn't run tests
yq -r ' .'${ENVIRONMENT}'.flags["can-tests-e2e"] | if . == null then true else . end ' $ROOT/environments.yaml | grep -q true || {
echo "The environment $ENVIRONMENT does not support tests. Skipping"
exit 0
}
if [ -z $PYTHONPATH ]; then
PYTHONPATH=$ROOT/shared/tests/integ
else
PYTHONPATH=$PYTHONPATH:$ROOT/shared/tests/integ
fi
ECOM_ENVIRONMENT=${ENVIRONMENT} \
PYTHONPATH=${PYTHONPATH} \
pytest $tests_dir \
--override-ini junit_family=xunit2 \
--junitxml $reports_dir/e2e.xml
}
tests_e2e