forked from bokysan/docker-postfix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration-tests.sh
More file actions
executable file
·59 lines (52 loc) · 1.32 KB
/
integration-tests.sh
File metadata and controls
executable file
·59 lines (52 loc) · 1.32 KB
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
#!/usr/bin/env bash
set -e
./build.sh --load --tag boky/postfix
cd integration-tests
FIND="$(which find)"
# Support running on macOS with GNU installed under "g*" prefix
if command -v gfind > /dev/null 2>&1; then
FIND="$(which gfind)"
fi
if command -v docker >/dev/null 2>&1; then
DOCKER_COMPOSE="docker-compose"
if docker --help | grep -q -F 'compose*'; then
DOCKER_COMPOSE="docker compose"
fi
elif command -v podman >/dev/null 2>&1; then
DOCKER_COMPOSE="podman compose"
else
echo "Neither `docker` or `podman` installed. Cannot execute tests."
exit 1
fi
run_test() {
local exit_code
echo
echo
echo "☆☆☆☆☆☆☆☆☆☆ $1 ☆☆☆☆☆☆☆☆☆☆"
echo
(
cd "$1"
set +e
$DOCKER_COMPOSE up --build --abort-on-container-exit --exit-code-from tests
exit_code="$?"
$DOCKER_COMPOSE down -v
if [[ "$exit_code" != 0 ]]; then
exit "$exit_code"
fi
set -e
)
}
if [[ $# -gt 0 ]]; then
while [[ -n "$1" ]]; do
run_test "$1"
shift
done
else
for i in `${FIND} -maxdepth 1 -type d | grep -Ev "^./(tester|xoauth2)" | sort`; do
i="$(basename "$i")"
if [ "$i" == "." ] || [ "$i" == ".." ]; then
continue
fi
run_test $i
done
fi