Skip to content

Commit fc7cc91

Browse files
authored
add test to choose between docker-compose and docker compose (#39)
1 parent b284474 commit fc7cc91

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/run.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@
66
RED='\033[0;31m'
77
GREEN='\033[0;32m'
88
NC='\033[0m'
9+
DOCKERCOMPOSE='docker compose'
10+
if type 'docker-compose' >/dev/null 2>&1; then
11+
# fallback to docker-compose v1
12+
DOCKERCOMPOSE='docker-compose'
13+
fi
914

1015
# kill and remove any running containers
1116
cleanup () {
12-
docker compose -p ci kill
13-
docker compose -p ci rm -f
17+
${DOCKERCOMPOSE} -p ci kill
18+
${DOCKERCOMPOSE} -p ci rm -f
1419
}
1520

1621
# catch unexpected failures, do cleanup and output an error message
1722
trap 'cleanup ; printf "${RED}Tests Failed For Unexpected Reasons${NC}\n"' HUP INT QUIT PIPE TERM
1823

1924
# build and run the composed services
20-
docker compose -p ci build && docker compose -p ci up -d
25+
${DOCKERCOMPOSE} -p ci build && ${DOCKERCOMPOSE} -p ci up -d
2126
if (( $? != 0 )); then
2227
printf "${RED}Docker Compose Failed${NC}\n"
2328
exit -1

0 commit comments

Comments
 (0)