Quality / test (push) Canceled after 0s
Add restore verification and image-storage recovery scripts, update deployment documentation, and note the restore drill milestone in the implementation status.
27 lines
758 B
Bash
27 lines
758 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
test_dir=$(mktemp -d)
|
|
trap 'rm -rf "$test_dir"' EXIT
|
|
|
|
mkdir -p "$test_dir/source/subdir"
|
|
printf '%s\n' 'hello' > "$test_dir/source/file.txt"
|
|
mkdir -p "$test_dir/target"
|
|
|
|
IMAGE_STORAGE_SOURCE="$test_dir/source" \
|
|
IMAGE_STORAGE_DESTINATION="$test_dir/target" \
|
|
sh "$script_dir/restore-image-storage.sh" >/dev/null
|
|
|
|
[ -f "$test_dir/target/file.txt" ]
|
|
[ "$(cat "$test_dir/target/file.txt")" = 'hello' ]
|
|
|
|
if IMAGE_STORAGE_SOURCE="$test_dir/missing" \
|
|
IMAGE_STORAGE_DESTINATION="$test_dir/target" \
|
|
sh "$script_dir/restore-image-storage.sh" >/dev/null 2>&1; then
|
|
printf '%s\n' 'Expected missing source to fail.' >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\n' 'restore-image-storage tests passed.'
|