fix: harden workspace registry deployment
This commit is contained in:
@@ -10,6 +10,7 @@ project="thoth-workspace-registry-smoke-$$"
|
||||
remote="$tmp/remote.git"
|
||||
seed="$tmp/seed"
|
||||
branch="workspace-registry-smoke"
|
||||
core_remote="/fixtures/remote.git"
|
||||
|
||||
cleanup() {
|
||||
compose down --volumes --remove-orphans >/dev/null 2>&1 || true
|
||||
@@ -33,7 +34,7 @@ services:
|
||||
THT_BIN: /opt/venv/bin/tht
|
||||
SETTINGS_FILE: /tmp/settings.json
|
||||
THT_WORKSPACE_REGISTRY_ROOT: /data/workspace-registry
|
||||
THT_WORKSPACE_GIT_REMOTE: /fixtures/remote.git
|
||||
THT_WORKSPACE_GIT_REMOTE: $core_remote
|
||||
THT_WORKSPACE_GIT_BRANCH: $branch
|
||||
THT_WORKSPACE_INSTALLATION_ID: smoke
|
||||
THT_WORKSPACE_SECRET_ROOTS: /run/secrets
|
||||
@@ -81,13 +82,16 @@ initial_status="$(compose exec -T core curl -fsS http://127.0.0.1:8787/workspace
|
||||
printf '%s' "$initial_status" | grep -Eq '"head":"[0-9a-f]{40}"'
|
||||
compose exec -T core test -f /data/workspace-registry/state/active.json
|
||||
|
||||
echo "== Recreate core and prove registry volume persistence =="
|
||||
echo "== Recreate offline and prove registry-volume fallback =="
|
||||
core_remote="/fixtures/offline.git"
|
||||
compose up -d --force-recreate
|
||||
wait_for_core
|
||||
recreated_status="$(compose exec -T core curl -fsS http://127.0.0.1:8787/workspace-registry/status)"
|
||||
initial_head="$(printf '%s' "$initial_status" | sed -n 's/.*"head":"\([0-9a-f]*\)".*/\1/p')"
|
||||
recreated_head="$(printf '%s' "$recreated_status" | sed -n 's/.*"head":"\([0-9a-f]*\)".*/\1/p')"
|
||||
test -n "$initial_head" && test "$initial_head" = "$recreated_head"
|
||||
printf '%s' "$recreated_status" | grep -Fq '"degraded":true'
|
||||
compose exec -T core curl -fsS http://127.0.0.1:8787/workspaces | grep -Fq 'Local'
|
||||
|
||||
echo "== Pull a valid remote update =="
|
||||
sed -i.bak 's/name: Local/name: Local Updated/' "$seed/workspaces/local.yaml"
|
||||
@@ -96,6 +100,9 @@ git -C "$seed" add workspaces/local.yaml
|
||||
git -C "$seed" -c user.name='Workspace Registry Smoke' -c user.email='workspace-registry-smoke@example.invalid' \
|
||||
commit -m 'Update workspace registry smoke' >/dev/null
|
||||
git -C "$seed" push origin "HEAD:$branch" >/dev/null
|
||||
core_remote="/fixtures/remote.git"
|
||||
compose up -d --force-recreate
|
||||
wait_for_core
|
||||
compose exec -T core curl -fsS -X POST http://127.0.0.1:8787/workspace-registry/pull | grep -Eq '"head":"[0-9a-f]{40}"'
|
||||
compose exec -T core curl -fsS http://127.0.0.1:8787/workspaces | grep -Fq 'Local Updated'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user