tests: adapt data-bot-bash created at installation

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2021-01-01 19:25:25 +01:00
parent 74dfdd753f
commit 7b6a6ca9c3
4 changed files with 11 additions and 8 deletions

View File

@ -26,7 +26,7 @@
# 8 - curl/wget missing # 8 - curl/wget missing
# 10 - not bash! # 10 - not bash!
# #
#### $$VERSION$$ v1.21-pre-6-g23e04a9 #### $$VERSION$$ v1.21-pre-7-g74dfdd7
################################################################## ##################################################################
# shellcheck disable=SC2140,SC2031,SC2120,SC1091,SC1117,SC2059 # shellcheck disable=SC2140,SC2031,SC2120,SC1091,SC1117,SC2059
@ -235,8 +235,7 @@ if [ -z "${BOTTOKEN}" ]; then
fi fi
# check data dir file # check data dir file
if [ ! -w "${DATADIR}" ]; then if [ ! -w "${DATADIR}" ]; then
printf "${RED}ERROR: Can't write to ${DATADIR}!.${NN}" printf "${RED}ERROR: ${DATADIR} does not exist or is not writeable!.${NN}"
ls -ld "${DATADIR}"
exit 2 exit 2
fi fi
# setup count file # setup count file

View File

@ -5,7 +5,7 @@
# #
# Description: run all tests, exit after failed test # Description: run all tests, exit after failed test
# #
#### $$VERSION$$ v1.21-pre-3-gbbbf57c #### $$VERSION$$ v1.21-pre-7-g74dfdd7
############################################################# #############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
@ -27,6 +27,9 @@ cd "test" || exit 1
# delete possible config # delete possible config
rm -f "${TESTENV}/botconfig.jssh" "${TESTENV}/botacl" 2>/dev/null rm -f "${TESTENV}/botconfig.jssh" "${TESTENV}/botacl" 2>/dev/null
# mkdir needed dirs
mkdir "${TESTENV}/data-bot-bash"
# inject JSON.sh # inject JSON.sh
mkdir "${TESTENV}/JSON.sh" mkdir "${TESTENV}/JSON.sh"
curl -sL "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" >"${TESTENV}/JSON.sh/JSON.sh" curl -sL "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" >"${TESTENV}/JSON.sh/JSON.sh"

View File

@ -7,7 +7,7 @@
# #
# Options: --notest - skip tests # Options: --notest - skip tests
# #
#### $$VERSION$$ v1.21-pre-3-gbbbf57c #### $$VERSION$$ v1.21-pre-7-g74dfdd7
############################################################## ##############################################################
# magic to ensure that we're always inside the root of our application, # magic to ensure that we're always inside the root of our application,
@ -25,7 +25,7 @@ VERSION="$(git describe --tags | sed -e 's/-[0-9].*//' -e 's/v//')"
DISTNAME="telegram-bot-bash" DISTNAME="telegram-bot-bash"
DISTDIR="./DIST/${DISTNAME}" DISTDIR="./DIST/${DISTNAME}"
DISTFILES="bashbot.rc bashbot.sh commands.sh mycommands.sh mycommands.sh.clean bin doc examples scripts modules addons LICENSE README.md README.txt README.html" DISTFILES="bashbot.rc bashbot.sh commands.sh mycommands.sh mycommands.sh.clean bin doc examples scripts modules addons LICENSE README.md README.txt README.html"
DISTMKDIR="data-bot-bash logs" DISTMKDIR="data-bot-bash logs bin bin/logs"
# run tests first! # run tests first!
for test in $1 dev/all-test*.sh for test in $1 dev/all-test*.sh
@ -33,7 +33,7 @@ do
[[ "${test}" == "--notest"* ]] && break [[ "${test}" == "--notest"* ]] && break
[ ! -x "${test}" ] && continue [ ! -x "${test}" ] && continue
if ! "${test}" ; then if ! "${test}" ; then
printf "Test %s failed, can't create dist!\n" "${test}" printf "ERROR: Test %s failed, can't create dist!\n" "${test}"
exit 1 exit 1
fi fi
done done

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#### $$VERSION$$ v1.21-dev-10-g9bfc27a #### $$VERSION$$ v1.21-pre-7-g74dfdd7
# include common functions and definitions # include common functions and definitions
# shellcheck source=test/ALL-tests.inc.sh # shellcheck source=test/ALL-tests.inc.sh
@ -37,6 +37,7 @@ TESTFILES="${TOKENFILE} ${ACLFILE}"
echo "Check first run in ENVIRONMENT ..." echo "Check first run in ENVIRONMENT ..."
mkdir "${BASHBOT_VAR}/${DATADIR}"
# run bashbot first time with init # run bashbot first time with init
"${BASHBOT_BIN}/bashbot.sh" init >"${LOGFILE}" <<EOF "${BASHBOT_BIN}/bashbot.sh" init >"${LOGFILE}" <<EOF