-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathrun_tests_with_s2i.sh
executable file
·53 lines (48 loc) · 1.55 KB
/
run_tests_with_s2i.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
#!/usr/bin/env bash
# Parameters allowed:
# . --repository-url
# . --branch-to-test
# . --maven-settings
# . --maven-mirror-url
# . --ocp-database-file
UNMANAGED_PARAMS=""
SOURCE_REPOSITORY_URL="https://github.com/snowdrop/crud-example"
SOURCE_REPOSITORY_REF="sb-2.7.x"
MAVEN_SETTINGS_REF=""
MAVEN_MIRROR_URL=""
OCP_DATABASE_FILE=".openshiftio/database.yaml"
while [ $# -gt 0 ]; do
if [[ $1 == *"--"* ]]; then
param="${1/--/}"
case $1 in
--repository-url) SOURCE_REPOSITORY_URL="$2";;
--branch-to-test) SOURCE_REPOSITORY_REF="$2";;
--maven-settings) MAVEN_SETTINGS_REF="-s $2";;
--maven-mirror-url) MAVEN_MIRROR_URL="$2";;
--ocp-database-file) OCP_DATABASE_FILE="$2";;
*) UNMANAGED_PARAMS="${UNMANAGED_PARAMS} $1 $2";;
esac;
shift
elif [[ $1 == "-D"* ]];
then
UNMANAGED_PARAMS="${UNMANAGED_PARAMS} $1";
fi
shift
done
source scripts/waitFor.sh
# deploy database
oc create -f ${OCP_DATABASE_FILE}
if [[ $(waitFor "my-database" "app") -eq 1 ]] ; then
echo "Database failed to deploy. Aborting"
exit 1
fi
# deploy application
oc create -f .openshiftio/application.yaml
oc new-app --template=crud -p SOURCE_REPOSITORY_URL=$SOURCE_REPOSITORY_URL -p SOURCE_REPOSITORY_REF=$SOURCE_REPOSITORY_REF \
-p MAVEN_MIRROR_URL=$MAVEN_MIRROR_URL -p MAVEN_ARGS_APPEND="$UNMANAGED_PARAMS"
if [[ $(waitFor "crud" "app") -eq 1 ]] ; then
echo "Application failed to deploy. Aborting"
exit 1
fi
# Run Tests
eval "./mvnw ${MAVEN_SETTINGS_REF} clean verify -Popenshift,openshift-it -Dunmanaged-test=true ${UNMANAGED_PARAMS}"