makes tests easy to select

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

@ -29,9 +29,11 @@ $( cat .sops.yaml )
EOM EOM
mv .sops.yaml.tmp .sops.yaml mv .sops.yaml.tmp .sops.yaml
# TEST # TESTCASES
# define "fixture" # define "fixture"
repo_root="$(git rev-parse --show-toplevel)" repo_root="$(git rev-parse --show-toplevel)"
# ---
if [[ 1 -eq 1 ]]; then
>&2 echo -e "# ---\n# TEST: create sops cfg in default dir: ${repo_root}" >&2 echo -e "# ---\n# TEST: create sops cfg in default dir: ${repo_root}"
set -x set -x
rm "${PWD}/.sops.yaml" || : rm "${PWD}/.sops.yaml" || :
@ -46,14 +48,25 @@ echo "TEST RC: $?"
# enmesh: restore, since this particular one is checked in # enmesh: restore, since this particular one is checked in
git checkout "${PWD}/.sops.yaml" git checkout "${PWD}/.sops.yaml"
rm "${repo_root}/.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}" >&2 echo -e "# ---\n# TEST: create sops cfg in curdir: ${PWD}"
echo "ERROR: failing right now" echo "ERROR: failing right now"
rm .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"
rm "${PWD}/.sops.yaml" || :
../bin/update_sops.sh -c "${PWD}" -s "${secrets_file}" ../bin/update_sops.sh -c "${PWD}" -s "${secrets_file}"
test -e "${PWD}/.sops.yaml" test -e "${PWD}/.sops.yaml"
test ! -e "${repo_root}/.sops.yaml" test ! -e "${repo_root}/.sops.yaml"
read -p "next test?" __var echo $?
else
>&2 echo "# INFO: skipping ...."
fi
# --- # ---
echo "TEST SUCCESS" echo "TESTCASES PASSED"
exit 0 exit 0

Loading…
Cancel
Save