2016-06-16 19:34:25 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# `SECRET_PROJECT_ROOT` must be set before running the script.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2019-03-27 05:10:07 +00:00
|
|
|
#TEST_DIR="/tmp/tempdir with spaces"
|
|
|
|
TEST_DIR="/tmp/tempdir"
|
2018-07-14 19:23:39 +00:00
|
|
|
|
2019-03-27 05:10:07 +00:00
|
|
|
rm -rf "${TEST_DIR}"
|
|
|
|
mkdir "${TEST_DIR}"
|
|
|
|
chmod 0700 "${TEST_DIR}"
|
|
|
|
(
|
|
|
|
cd "${TEST_DIR}"
|
2018-08-25 14:05:17 +00:00
|
|
|
|
2019-03-27 05:10:07 +00:00
|
|
|
# test with non-standard SECRETS_DIR (normally .gitsecret) and SECRETS_EXTENSION (normally .secret)
|
|
|
|
export SECRETS_DIR=.gitsecret-testdir
|
|
|
|
export SECRETS_EXTENSION=.secret2
|
|
|
|
#export SECRETS_VERBOSE=''
|
2019-02-11 21:33:59 +00:00
|
|
|
|
2019-03-29 22:11:52 +00:00
|
|
|
#export TMPDIR="${TEST_DIR}" # uncommenting this line seems to cause #451
|
2019-03-27 05:10:07 +00:00
|
|
|
#echo "# TMPDIR is $TMPDIR"
|
|
|
|
|
|
|
|
# bats expects diagnostic lines to be sent to fd 3, matching regex '^ #' (IE, like: `echo '# message here' >&3`)
|
|
|
|
# bats ... 3>&1 shows diagnostic output when errors occur.
|
|
|
|
bats "${SECRET_PROJECT_ROOT}/tests/" 3>&1
|
|
|
|
)
|
|
|
|
|
|
|
|
rm -rf "${TEST_DIR}"
|