Skip to content

Commit

Permalink
(#76) throwing error when SAKULI_TEST_SUITE does not contain suite
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffle committed Nov 3, 2020
1 parent cc41b94 commit 1d7d309
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
15 changes: 14 additions & 1 deletion .test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,17 @@ docker run \
--shm-size=2G \
-u 45678:12345 \
taconsol/sakuli:${1:-latest} \
"echo success!"
"echo success!"

# ensure error is thrown when
set +e
docker run \
--rm \
-e SAKULI_LICENSE_KEY=${SAKULI_LICENSE_KEY} \
-e SAKULI_TEST_SUITE=/testsuite \
-v $(pwd)/e2e:/testsuite \
--shm-size=2G \
taconsol/sakuli:${1:-latest}
[[ "$?" != "1" ]] && echo "Expected error code == 1" && exit 1
set -e

17 changes: 4 additions & 13 deletions src/common/scripts/execute_testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ syncToExecutionDir(){
logDebug "Syncing test suite"
rsync ${RSYNC_OPTIONS} ${1}/ ${SAKULI_EXECUTION_DIR}/${SAKULI_SUITE_NAME} --exclude=node_modules --exclude=_logs/_screenshots
else
SAKULI_SUITE_NAME=$( cat ${1}/package.json | grep \"test\" | xargs | cut -d " " -f 4 | rev | cut -c2- | rev )
logDebug "Found suite name from project package.json: ${SAKULI_SUITE_NAME}"
logDebug "Syncing project files"
rsync ${RSYNC_OPTIONS} ${1}/* ${SAKULI_EXECUTION_DIR} --exclude='*/'
logDebug "Syncing test suite"
rsync ${RSYNC_OPTIONS} ${1}/${SAKULI_SUITE_NAME} ${SAKULI_EXECUTION_DIR} --exclude=node_modules --exclude=_logs/_screenshots
printf '\n%s\n' "ERROR: SAKULI_TEST_SUITE does not contain a valid Sakuli suite" >&2
exit 1
fi
}

Expand Down Expand Up @@ -78,13 +74,8 @@ logDebug "remove global node_modules link from ${SAKULI_EXECUTION_DIR}"

## Restore logs and screenshots into the actual mounted volume, if possible
if [ -z "$GIT_URL" ]; then
if [[ -f ${SAKULI_TEST_SUITE}/testsuite.properties && -f ${SAKULI_TEST_SUITE}/testsuite.suite ]]; then
logDebug "Restoring logs and screenshots to ${SAKULI_TEST_SUITE}"
RESTORE_COMMAND="rsync ${RSYNC_OPTIONS} ${SAKULI_EXECUTION_DIR}/${SAKULI_SUITE_NAME}/_logs ${SAKULI_TEST_SUITE}"
else
logDebug "Restoring logs and screenshots to ${SAKULI_TEST_SUITE}/${SAKULI_SUITE_NAME}"
RESTORE_COMMAND="rsync ${RSYNC_OPTIONS} ${SAKULI_EXECUTION_DIR}/${SAKULI_SUITE_NAME}/_logs ${SAKULI_TEST_SUITE}/${SAKULI_SUITE_NAME}"
fi
logDebug "Restoring logs and screenshots to ${SAKULI_TEST_SUITE}"
RESTORE_COMMAND="rsync ${RSYNC_OPTIONS} ${SAKULI_EXECUTION_DIR}/${SAKULI_SUITE_NAME}/_logs ${SAKULI_TEST_SUITE}"
logDebug "${RESTORE_COMMAND}"
if [[ $DEBUG == true ]]; then
${RESTORE_COMMAND}
Expand Down

0 comments on commit 1d7d309

Please sign in to comment.