makes tests easy to select

ADP-216_sops_automation
LeeW 10 months ago
parent bd29587565
commit ae828f75d1

@ -29,31 +29,44 @@ $( cat .sops.yaml )
EOM
mv .sops.yaml.tmp .sops.yaml
# TEST
# TESTCASES
# define "fixture"
repo_root="$(git rev-parse --show-toplevel)"
>&2 echo -e "# ---\n# TEST: create sops cfg in default dir: ${repo_root}"
set -x
rm "${PWD}/.sops.yaml" || :
# note: fail if for any reason sops config defined at top level; this repo should not have this!
test ! -e "${repo_root}/.sops.yaml"
../bin/update_sops.sh -s "${secrets_file}" > /dev/null 2>&1
test ! -e "${PWD}/.sops.yaml"
test -e "${repo_root}/.sops.yaml"
set +x
echo "TEST RC: $?"
# teardown
# enmesh: restore, since this particular one is checked in
git checkout "${PWD}/.sops.yaml"
rm "${repo_root}/.sops.yaml"
>&2 echo -e "# ---\n# TEST: create sops cfg in curdir: ${PWD}"
echo "ERROR: failing right now"
rm .sops.yaml
../bin/update_sops.sh -c "${PWD}" -s "${secrets_file}"
test -e "${PWD}/.sops.yaml"
test ! -e "${repo_root}/.sops.yaml"
read -p "next test?" __var
# ---
if [[ 1 -eq 1 ]]; then
>&2 echo -e "# ---\n# TEST: create sops cfg in default dir: ${repo_root}"
set -x
rm "${PWD}/.sops.yaml" || :
# note: fail if for any reason sops config defined at top level; this repo should not have this!
test ! -e "${repo_root}/.sops.yaml"
../bin/update_sops.sh -s "${secrets_file}" > /dev/null 2>&1
test ! -e "${PWD}/.sops.yaml"
test -e "${repo_root}/.sops.yaml"
set +x
echo "TEST RC: $?"
# teardown
# enmesh: restore, since this particular one is checked in
git checkout "${PWD}/.sops.yaml"
rm "${repo_root}/.sops.yaml"
else
>&2 echo "# INFO: skipping ...."
fi
# ---
if [[ 0 -eq 1 ]]; then
>&2 echo -e "# ---\n# TEST: create sops cfg in curdir: ${PWD}"
echo "ERROR: failing right now"
# note: fail if for any reason sops config defined at top level; this repo should not have this!
test ! -e "${repo_root}/.sops.yaml"
rm "${PWD}/.sops.yaml" || :
../bin/update_sops.sh -c "${PWD}" -s "${secrets_file}"
test -e "${PWD}/.sops.yaml"
test ! -e "${repo_root}/.sops.yaml"
echo $?
else
>&2 echo "# INFO: skipping ...."
fi
# ---
echo "TEST SUCCESS"
echo "TESTCASES PASSED"
exit 0

Loading…
Cancel
Save