Merge pull request #9651 from thalesmg/stop-containers-ct-run-v50
chore(docker): add option to stop local testing containers (v5.0)
This commit is contained in:
commit
2f482a653c
|
@ -14,6 +14,7 @@ help() {
|
||||||
echo "--suites SUITE1,SUITE2: Comma separated SUITE names to run. e.g. apps/emqx/test/emqx_SUITE.erl"
|
echo "--suites SUITE1,SUITE2: Comma separated SUITE names to run. e.g. apps/emqx/test/emqx_SUITE.erl"
|
||||||
echo "--console: Start EMQX in console mode but do not run test cases"
|
echo "--console: Start EMQX in console mode but do not run test cases"
|
||||||
echo "--attach: Attach to the Erlang docker container without running any test case"
|
echo "--attach: Attach to the Erlang docker container without running any test case"
|
||||||
|
echo "--stop: Stop running containers for the given app"
|
||||||
echo "--only-up: Only start the testbed but do not run CT"
|
echo "--only-up: Only start the testbed but do not run CT"
|
||||||
echo "--keep-up: Keep the testbed running after CT"
|
echo "--keep-up: Keep the testbed running after CT"
|
||||||
}
|
}
|
||||||
|
@ -24,6 +25,7 @@ KEEP_UP='no'
|
||||||
ONLY_UP='no'
|
ONLY_UP='no'
|
||||||
SUITES=''
|
SUITES=''
|
||||||
ATTACH='no'
|
ATTACH='no'
|
||||||
|
STOP='no'
|
||||||
while [ "$#" -gt 0 ]; do
|
while [ "$#" -gt 0 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
|
@ -46,6 +48,10 @@ while [ "$#" -gt 0 ]; do
|
||||||
ATTACH='yes'
|
ATTACH='yes'
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
|
--stop)
|
||||||
|
STOP='yes'
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
--console)
|
--console)
|
||||||
CONSOLE='yes'
|
CONSOLE='yes'
|
||||||
shift 1
|
shift 1
|
||||||
|
@ -155,8 +161,10 @@ else
|
||||||
export UID_GID="$ORIG_UID_GID"
|
export UID_GID="$ORIG_UID_GID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
if [ "$STOP" = 'no' ]; then
|
||||||
docker-compose $F_OPTIONS up -d --build --remove-orphans
|
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
||||||
|
docker-compose $F_OPTIONS up -d --build --remove-orphans
|
||||||
|
fi
|
||||||
|
|
||||||
# /emqx is where the source dir is mounted to the Erlang container
|
# /emqx is where the source dir is mounted to the Erlang container
|
||||||
# in .ci/docker-compose-file/docker-compose.yaml
|
# in .ci/docker-compose-file/docker-compose.yaml
|
||||||
|
@ -183,7 +191,10 @@ fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
if [ "$ATTACH" = 'yes' ]; then
|
if [ "$STOP" = 'yes' ]; then
|
||||||
|
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
||||||
|
docker-compose $F_OPTIONS down --remove-orphans
|
||||||
|
elif [ "$ATTACH" = 'yes' ]; then
|
||||||
docker exec -it "$ERLANG_CONTAINER" bash
|
docker exec -it "$ERLANG_CONTAINER" bash
|
||||||
restore_ownership
|
restore_ownership
|
||||||
elif [ "$CONSOLE" = 'yes' ]; then
|
elif [ "$CONSOLE" = 'yes' ]; then
|
||||||
|
|
Loading…
Reference in New Issue