update new urls for V2
This commit is contained in:
1 parent
d73ea2fb2b
commit
93e243016b
6 files changed
+40
-154
No files matched your search
@@ -5,41 +5,29 @@ TEST_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
test_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$test_dir"' EXIT
|
||||
|
||||
TAPM_CONFIG_FILE="${test_dir}/etc/config.env"
|
||||
TAPM_CONFIG_TEST_STDIN=1
|
||||
source "${TEST_ROOT}/inc/runtime-config.inc"
|
||||
|
||||
if ! printf '%s\n%s\n' \
|
||||
'https://tapm.example.com' \
|
||||
'git.example.com' |
|
||||
TAPM_ENSURE_RUNTIME_CONFIG >/dev/null; then
|
||||
printf 'FAIL: configuration wizard failed\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
expected=$'TAPM_BROKER_URL=https://tapm.example.com\nGITEA_DOMAIN=git.example.com'
|
||||
actual="$(cat "$TAPM_CONFIG_FILE")"
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
printf 'FAIL: unexpected configuration contents\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
if stat -c '%a' "$TAPM_CONFIG_FILE" >/dev/null 2>&1; then
|
||||
config_mode="$(stat -c '%a' "$TAPM_CONFIG_FILE")"
|
||||
else
|
||||
config_mode="$(stat -f '%Lp' "$TAPM_CONFIG_FILE")"
|
||||
fi
|
||||
if [[ "$config_mode" != 600 ]]; then
|
||||
printf 'FAIL: configuration mode is not 600\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset TAPM_BROKER_URL GITEA_DOMAIN GITEA_URL
|
||||
TAPM_LOAD_RUNTIME_CONFIG
|
||||
if [[ "$TAPM_BROKER_URL" != 'https://tapm.example.com' ||
|
||||
"$GITEA_DOMAIN" != 'git.example.com' ||
|
||||
"$GITEA_URL" != 'https://git.example.com' ]]; then
|
||||
printf 'FAIL: saved configuration did not reload\n' >&2
|
||||
if ! TAPM_ENSURE_RUNTIME_CONFIG >/dev/null; then
|
||||
printf 'FAIL: built-in configuration was rejected\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'PASS: runtime configuration wizard\n'
|
||||
if [[ "$TAPM_BROKER_URL" != 'https://tapm.technologyarch.com' ||
|
||||
"$GITEA_DOMAIN" != 'tagit.technologyarch.com' ||
|
||||
"$GITEA_URL" != 'https://tagit.technologyarch.com' ]]; then
|
||||
printf 'FAIL: built-in configuration did not load\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAPM_BROKER_URL='https://tapm.test.example'
|
||||
GITEA_DOMAIN='git.test.example'
|
||||
TAPM_LOAD_RUNTIME_CONFIG
|
||||
if [[ "$TAPM_BROKER_URL" != 'https://tapm.test.example' ||
|
||||
"$GITEA_DOMAIN" != 'git.test.example' ||
|
||||
"$GITEA_URL" != 'https://git.test.example' ]]; then
|
||||
printf 'FAIL: environment overrides did not load\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf 'PASS: built-in runtime configuration\n'
|
||||
Reference in new issue
Block a user