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