-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-env-and-tests.sh
executable file
·99 lines (89 loc) · 2.26 KB
/
run-env-and-tests.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
#!/bin/bash -e
show_help() {
echo "Usage: ./run-evn-and-tests.sh --env <docker|eck> --elk <elk_version> [--ror-es <ror_es_version> (default: latest) --ror-kbn <ror_kbn_version> (default: latest) --dev (use dev images)]"
exit 1
}
ENV_NAME=""
ELK_VERSION="$1"
ROR_ES_VERSION=""
ROR_KBN_VERSION=""
MODE=""
while [[ $# -gt 0 ]]; do
case $1 in
--env)
if [[ -n $2 && $2 != --* ]]; then
case "$2" in
"docker")
ENV_NAME="elk-ror"
;;
"eck")
ENV_NAME="eck-ror"
;;
*)
echo "Error: --env: Only "docker" and 'eck' are available environments"
show_help
;;
esac
shift 2
else
echo "Error: --env requires a version argument"
show_help
fi
;;
--elk)
if [[ -n $2 && $2 != --* ]]; then
ELK_VERSION="$2"
shift 2
else
echo "Error: --elk requires a version argument"
show_help
fi
;;
--ror-es)
if [[ -n $2 && $2 != --* ]]; then
ROR_ES_VERSION="--ror-es $2"
shift 2
else
echo "Error: --ror-es requires a version argument"
show_help
fi
;;
--ror-kbn)
if [[ -n $2 && $2 != --* ]]; then
ROR_KBN_VERSION="--ror-kbn $2"
shift 2
else
echo "Error: --ror-kbn requires a version argument"
show_help
fi
;;
--dev)
MODE="--dev"
shift
;;
*)
echo "Unknown option: $1"
show_help
;;
esac
done
handle_error() {
./environments/"$ENV_NAME"/print-logs.sh
}
cleanup() {
./environments/"$ENV_NAME"/stop-and-clean.sh
}
trap handle_error ERR
trap cleanup EXIT
echo -e "
_____ _ ____ _ _____ ______ _____ _______
| __ \ | |/ __ \ | | | __ \| ____|/ ____|__ __|
| |__) |___ __ _ __| | | | |_ __ | |_ _| |__) | |__ | (___ | |
| _ // _ \/ _| |/ _| | | | | '_ \| | | | | _ /| __| \___ \ | |
| | \ \ __/ (_| | (_| | |__| | | | | | |_| | | \ \| |____ ____) | | |
|_| \_\___|\__,_|\__,_|\____/|_| |_|_|\__, |_| \_\______|_____/ |_|
__/ |
"
echo -e "E2E TESTS\n"
time ./environments/$ENV_NAME/start.sh --es "$ELK_VERSION" --kbn "$ELK_VERSION" $ROR_ES_VERSION $ROR_KBN_VERSION $MODE
time ./e2e-tests/run-tests.sh "$ELK_VERSION"