#!/usr/bin/env bash set -Eeuo pipefail cd "$(dirname "$0")/.." compose() { docker compose -f dev/compose.yaml "$@"; } marker=".cephmig-restart-$(cat /proc/sys/kernel/random/uuid)" source_fsid=$(compose exec -T source ceph fsid) target_fsid=$(compose exec -T target ceph fsid) test "$source_fsid" != "$target_fsid" cleanup() { compose exec -T client rm -f "/mnt/source/$marker" "/mnt/target/$marker" || true } trap cleanup EXIT compose exec -T client bash -c 'printf source > "/mnt/source/$1"; printf target > "/mnt/target/$1"' bash "$marker" compose down compose up -d --wait --wait-timeout 300 test "$(compose exec -T source ceph fsid)" = "$source_fsid" test "$(compose exec -T target ceph fsid)" = "$target_fsid" test "$(compose exec -T client cat "/mnt/source/$marker")" = source test "$(compose exec -T client cat "/mnt/target/$marker")" = target echo 'PASS: cluster identities and subvolume data survive down/up'