Ver código fonte

build: run run.sh tests without being asked for sudo password

This commit makes it possible to run the scripts/ct/run.sh script
without being asked for sudo password if one instead wants to use the
run docker container with root user trick to reset owner of files.

One simply has to set the environment variable
EMQX_TEST_DO_NOT_RUN_SUDO.
Kjell Winblad 3 anos atrás
pai
commit
96318bda1d
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      scripts/ct/run.sh

+ 1 - 1
scripts/ct/run.sh

@@ -197,7 +197,7 @@ if [[ -t 1 ]]; then
 fi
 
 function restore_ownership {
-    if ! sudo chown -R "$ORIG_UID_GID" . >/dev/null 2>&1; then
+    if [[ -n ${EMQX_TEST_DO_NOT_RUN_SUDO+x} ]] || ! sudo chown -R "$ORIG_UID_GID" . >/dev/null 2>&1; then
         docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "chown -R $ORIG_UID_GID /emqx" >/dev/null 2>&1 || true
     fi
 }