Skip to content

Commit

Permalink
(#47) [WIP] change test execution to prevent insufficient permission …
Browse files Browse the repository at this point in the history
…issues when linking into volume
  • Loading branch information
svettwer committed Jul 27, 2020
1 parent 57e705e commit 34d1c7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
6 changes: 5 additions & 1 deletion Dockerfile.sakuli-ubuntu-openbox
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ ENV HOME=/headless \
VNC_PW=vncpassword \
VNC_VIEW_ONLY=false \
NPM_TOKEN=REPLACE_WITH_YOUR_NPM_TOKEN \
IMG=taconsol/sakuli
IMG=taconsol/sakuli \
EXECUTION_DIR=/testsuite_execution
WORKDIR $HOME

### Create EXECUTION_DIR and set permissions correctly
RUN mkdir ${EXECUTION_DIR} && chmod 777 ${EXECUTION_DIR}

### Copy all install scripts for further steps
COPY ./src/common/install/ $INST_SCRIPTS/
RUN find $INST_SCRIPTS -name '*.sh' -exec chmod a+x {} +
Expand Down
2 changes: 1 addition & 1 deletion src/common/install/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function install {
apt-get update -y
apt-get upgrade -y
echo "===> Installing common tools"
install wget locales gnome-calculator xfce4-screenshooter git nitrogen
install wget locales gnome-calculator xfce4-screenshooter git nitrogen rsync

echo "===> Installing libnss3-tool"
install libnss3-tools
Expand Down
7 changes: 2 additions & 5 deletions src/common/scripts/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ if [ $# -gt 0 ]; then
# pass all parameters
main "$@"
else
# no parameters
# - run the suite defined by $SAKULI_TEST_SUITE, if set
# or
# - run the example case (fallback)
pushd ${SAKULI_TEST_SUITE:-$HOME/demo_testcase}
# no parameters: Run test project placed in ${EXECUTION_DIR}
pushd ${EXECUTION_DIR}
main npm test
popd
fi
17 changes: 6 additions & 11 deletions src/common/scripts/vnc_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ fi

# Link global node_modules into the actual test suite
if [ "${SAKULI_TEST_SUITE}" ]; then
if [ -d ${SAKULI_TEST_SUITE}/node_modules ]; then
mv ${SAKULI_TEST_SUITE}/node_modules ${SAKULI_TEST_SUITE}/node_modules_bak
fi
ln -s $(npm root -g | head -n 1) ${SAKULI_TEST_SUITE}/node_modules
rsync -avqO ${SAKULI_TEST_SUITE}/* ${EXECUTION_DIR} --exclude node_modules
else
# Ensure nothing breaks if user mounts into ${HOME}/demo_testcase for any reason
rsync -avqO ${HOME}/demo_testcase/* ${EXECUTION_DIR} --exclude node_modules
fi
ln -s $(npm root -g | head -n 1) ${EXECUTION_DIR}/node_modules

set +e

Expand All @@ -124,13 +125,7 @@ else
$@
fi

# Remove the link to the actual test suite as it is most likely a mounted volume
if [ -d ${SAKULI_TEST_SUITE}/node_modules ]; then
rm -r ${SAKULI_TEST_SUITE}/node_modules
fi
# TODO: Distribute logs back to volume, if possible

if [ -d ${SAKULI_TEST_SUITE}/node_modules_bak ]; then
mv ${SAKULI_TEST_SUITE}/node_modules_bak ${SAKULI_TEST_SUITE}/node_modules
fi

set -e

0 comments on commit 34d1c7e

Please sign in to comment.