-
Notifications
You must be signed in to change notification settings - Fork 17
/
dpc-test.sh
executable file
·79 lines (63 loc) · 2.97 KB
/
dpc-test.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -Ee
# Current working directory
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Configure the Maven log level
export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=info
# Include secure environment variables
set -o allexport
[[ -f ${DIR}/ops/config/decrypted/local.env ]] && source ${DIR}/ops/config/decrypted/local.env
set +o allexport
function _finally {
docker compose -p start-v1-app down
docker volume rm start-v1-app_pgdata16
}
trap _finally EXIT
if [ -n "$REPORT_COVERAGE" ]; then
echo "┌──────────────────────────────────────┐"
echo "│ │"
echo "│ Running Tests and Coverage │"
echo "│ │"
echo "└──────────────────────────────────────┘"
else
echo "┌──────────────────────────────────────────┐"
echo "│ │"
echo "│ Running Tests.... │"
echo "│ REPORT_COVERAGE not set │"
echo "│ │"
echo "└──────────────────────────────────────────┘"
fi
# Build the application
docker compose -p start-v1-app up start_core_dependencies
mvn clean compile -Perror-prone -B -V -ntp
mvn package -Pci -ntp
# Format the test results
if [ -n "$REPORT_COVERAGE" ]; then
mvn jacoco:report -ntp
fi
docker compose -p start-v1-app down
docker volume rm start-v1-app_pgdata16
docker compose -p start-v1-app up start_core_dependencies
docker compose -p start-v1-app up start_api_dependencies
# Run the integration tests
docker compose -p start-v1-app up --exit-code-from tests tests
docker compose -p start-v1-app down
docker volume rm start-v1-app_pgdata16
docker compose -p start-v1-app up start_core_dependencies
docker compose -p start-v1-app up start_api_dependencies
# Start the API server
AUTH_DISABLED=true docker compose -p start-v1-app up start_api start_consent
# Run the Postman tests
npm install
npm run test
# Wait for Jacoco to finish writing the output files
docker compose -p start-v1-app down -t 60
# Collect the coverage reports for the Docker integration tests
if [ -n "$REPORT_COVERAGE" ]; then
mvn jacoco:report-integration -Pci -ntp
fi
echo "┌──────────────────────────────────────────┐"
echo "│ │"
echo "│ All Tests Complete │"
echo "│ │"
echo "└──────────────────────────────────────────┘"