Files
Andrey Kolkov 43b02bda30 test(e2e): run the Redis backup round-trip against Valkey
The Redis backup demo now takes APP_KIND=Valkey, which switches the app
kind and the chart prefix the helpers derive sentinel and Secret names
from. The demo BackupClass routes Valkey to the same demo strategy.

The valkey suite gains valkey-backup-roundtrip, which drives that demo
end to end: seed a marker, back it up, restore it in place and into a
copy. It writes to tenant-root's seaweedfs through seaweedfs-s3, so a
seaweedfs change now selects the valkey suite too, and since the
round-trip runs examples/backups/redis as its harness, an edit there
selects both the redis and the valkey suites. The reduced E2E install
keeps the backup stack for the valkey suite, as it does for the other
backup round-trip suites.

Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Assisted-By: LLM
2026-10-13 12:34:24 +04:00

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Step 01: Provision a Redis (RedisFailover) instance and seed a sentinel marker
# key used to prove the backup/restore round-trip carries the exact bytes.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/00-helpers.sh"
print_header "Step 01: Provision Redis '${REDIS_NAME}'"
kubectl apply -f - <<EOF
apiVersion: apps.cozystack.io/v1alpha1
kind: ${APP_KIND}
metadata:
name: ${REDIS_NAME}
namespace: ${NAMESPACE}
spec:
replicas: 2
resourcesPreset: nano
size: 1Gi
authEnabled: true
EOF
# The spotahome operator runs its StatefulSet with an OnDelete update strategy,
# which `kubectl rollout status` refuses; wait_redis_master polls the sentinel
# until a master is elected, which is the readiness signal that actually matters.
wait_redis_master "$REDIS_NAME"
log_substep "Writing marker ${MARKER_KEY}=${MARKER_VALUE}..."
redis_cmd "$REDIS_NAME" SET "$MARKER_KEY" "$MARKER_VALUE" >/dev/null
got=$(redis_cmd "$REDIS_NAME" GET "$MARKER_KEY")
[[ "$got" == "$MARKER_VALUE" ]] || { log_error "seed failed: read back '${got}'"; exit 1; }
log_success "Marker seeded on '${REDIS_NAME}'."
echo -e "\n${GREEN}${BOLD}Next:${NC} ./02-create-backupjob.sh"