-
Notifications
You must be signed in to change notification settings - Fork 20
/
_build-and-test-all.sh
executable file
·105 lines (78 loc) · 2.05 KB
/
_build-and-test-all.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#! /bin/bash
export TERM=dumb
USE_EXISTING=
set -e
GRADLE_OPTS=""
if [ "$1" = "--clean" ] ; then
GRADLE_OPTS="clean"
shift
fi
if [ "$1" = "--use-existing" ] ; then
USE_EXISTING=true
shift
fi
function gradlew() {
GRADLE_PROPERTIES="-P dbIdUsed=${DB_ID_USED:-false} -P useDbId=${USE_DB_ID:-false}"
if [ ! -z "$EVENTUATE_OUTBOX_ID" ] ; then
GRADLE_PROPERTIES="$GRADLE_PROPERTIES -P eventuateOutboxId=$EVENTUATE_OUTBOX_ID"
fi
./gradlew $GRADLE_PROPERTIES \
-P useJsonPayloadAndHeaders=${USE_JSON_PAYLOAD_AND_HEADERS:-false} $*
}
function dockerCompose() {
gradlew -P removeContainers=true ${DATABASE//-}Compose${1}
}
function dockerUp() {
echo "DOCKER UP WITH USE_DB_ID=$USE_DB_ID DB_ID_USED=$DB_ID_USED"
dockerCompose "Up"
}
function dockerDown() {
dockerCompose "Down"
# > Container 2ca5624f08b1e87c83379db571567aeb31c164634fe87faa5b980f1cdeb522b0 of mysql8_1 is not running. Logs:
sleep 5
}
function testJdbc() {
dockerUp
echo "RUNNING TESTS WITH USE_DB_ID=$USE_DB_ID DB_ID_USED=$DB_ID_USED"
gradlew :eventuate-common-micronaut-data-jdbc:cleanTest :eventuate-common-micronaut-data-jdbc:test \
:eventuate-common-spring-jdbc:cleanTest :eventuate-common-spring-jdbc:test
dockerDown
}
if [ -z "$USE_EXISTING" ]; then
dockerDown
fi
./gradlew ${GRADLE_OPTS} testClasses
unset USE_DB_ID
unset DB_ID_USED
echo ""
echo "==== TESTING REGULAR DATABASE"
echo ""
dockerUp
echo "RUNNING TESTS WITH USE_DB_ID=$USE_DB_ID DB_ID_USED=$DB_ID_USED"
gradlew cleanTest build
dockerDown
export USE_DB_ID=true
export DB_ID_USED=true
echo ""
echo "==== TESTING DATABASE WITH DBID WITH APPLICATION ID GENERATION"
echo ""
testJdbc
export EVENTUATE_OUTBOX_ID=1
echo ""
echo "==== TESTING DATABASE WITH DBID WITH DATABASE ID GENERATION"
echo ""
testJdbc
echo ""
echo "==== TESTING DBID MIGRATION"
echo ""
unset USE_DB_ID
dockerUp
./migration/db-id/migration.sh --local
testJdbc
echo ""
echo "==== TESTING DATABASE WITH JSON SUPPORT"
echo ""
unset DB_ID_USED
unset EVENTUATE_OUTBOX_ID
export USE_JSON_PAYLOAD_AND_HEADERS=true
testJdbc