-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest.sh
54 lines (47 loc) · 1.53 KB
/
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
#!/bin/bash
source ~/.bashrc
# Set environment variables
export AU_BACKEND_HOST="http://localhost:8900"
export AU_FRONTEND_HOST="http://localhost:3000"
export AU_APP_API="http://localhost:8900"
export AU_APP_WEBSOCKET="http://localhost:8900/portfolio"
export AU_DB_PORT="3306"
export AU_DB_USER="ioopm"
export AU_DB_PASSWORD="ioopm"
export AU_GITHUB_ORG="CHANGE_ME"
export AU_GITHUB_USER="CHANGE_ME"
export AU_GITHUB_USER_SECRET="CHANGE_ME"
export AU_GITHUB_CLIENT_ID="CHANGE_ME"
export AU_GITHUB_CLIENT_SECRET="CHANGE_ME"
export AU_KEY_ALIAS="tomcat"
export AU_KEY_STORE="$(pwd)/keystore/keystore.p12"
export AU_KEY_STORE_PASSWORD="password"
export AU_KEY_STORE_TYPE="PKCS12"
export AU_PROFILE_PICTURE_DIR="$(pwd)/profile_pictures/"
export AU_BACKUP_DIR="$(pwd)/au_backups/"
export TERM=xterm
# Create directories
mkdir -p au_backups
mkdir -p profile_pictures
mkdir -p keystore
mkdir -p logs
cd backend
rm -rf target
# Start tests based on the argument
if [ "$1" == "unit" ]; then
echo "Running only unit tests..."
mvn test -Dspring.profiles.active=test -Dmaven.test.failure.ignore=true
elif [ "$1" == "integration" ]; then
echo "Running only integration tests..."
mvn verify -Dspring.profiles.active=test -Dmaven.test.failure.ignore=true -DskipUnit=true
else
echo "Running all tests..."
mvn verify -Dspring.profiles.active=test -Dmaven.test.failure.ignore=true
fi
# Create JaCoCo report (stored in target/site/jacoco/)
mvn jacoco:report
# Clean up
rm -rf ../au_backups
rm -rf ../profile_pictures
rm -rf ../keystore
rm -rf ../logs