Files
cozystack/hack/e2e-chainsaw/valkey/chainsaw-test.yaml
T
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

146 lines
4.6 KiB
YAML

# Chainsaw test for the managed Valkey app (mirrors the redis suite).
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: valkey
spec:
catch:
- events: {}
- describe:
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
name: valkey-test
- podLogs:
selector: app.kubernetes.io/instance=valkey-test
tail: 50
steps:
- name: create-valkey
try:
- apply:
file: valkey.yaml
- name: wait-helmrelease-ready
try:
# 11m: above the 600s install timeout cozystack-api gives this release;
# see "Sizing an HR-Ready budget" in docs/agents/e2e-testing.md.
- assert:
timeout: 11m
resource:
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: valkey-test
status:
(conditions[?type == 'Ready']):
- status: "True"
- name: verify-storage-and-workloads
try:
# replicas: 2 provisions two StatefulSet-templated PVCs — verify both.
# The operator keeps the redisfailover-* resource naming regardless of the
# Valkey engine image, so these names match the redis suite.
- assert:
timeout: 2m
resource:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redisfailover-persistent-data-rfr-valkey-test-0
status:
phase: Bound
- assert:
timeout: 2m
resource:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redisfailover-persistent-data-rfr-valkey-test-1
status:
phase: Bound
- assert:
timeout: 2m
resource:
apiVersion: apps/v1
kind: Deployment
metadata:
name: rfs-valkey-test
status:
(conditions[?type == 'Available']):
- status: "True"
- assert:
timeout: 2m
resource:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: rfr-valkey-test
status:
readyReplicas: 2
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: valkey-backup-roundtrip
spec:
# The Redis backup round-trip (redis-2-backup-roundtrip) run against a Valkey
# app: Valkey shares the RedisFailover operator and the Redis strategy, so the
# same demo drives it with APP_KIND=Valkey. tenant-root and the .svc
# S3_ENDPOINT for the same reasons as there: tenant-test is egress-isolated
# from tenant-root's seaweedfs, and the seaweedfs serving cert's SANs cover
# 'seaweedfs-s3.tenant-root.svc'. The app names differ from the redis
# round-trip's so neither suite's leftovers can satisfy the other's waits.
namespace: tenant-root
skipDelete: true
catch:
- events: {}
- describe:
apiVersion: backups.cozystack.io/v1alpha1
kind: BackupJob
- describe:
apiVersion: backups.cozystack.io/v1alpha1
kind: RestoreJob
- describe:
apiVersion: strategy.backups.cozystack.io/v1alpha1
kind: Redis
name: redis-strategy-default
- podLogs:
selector: redis.strategy.backups.cozystack.io/mode
tail: 200
steps:
- name: run
try:
# Pre-clean so a stale Succeeded BackupJob from a prior run cannot satisfy
# the wait instantly. Idempotent; the catch cwd is the suite dir.
- script:
timeout: 8m
content: |
set -eu
cd ../../..
APP_KIND=Valkey REDIS_NAME=valkey-bkp REDIS_RESTORE_NAME=valkey-bkp-copy \
NAMESPACE="$NAMESPACE" examples/backups/redis/cleanup.sh
check:
($error == null): true
# 36m: sized with the 660s bucket HR wait in run-all.sh, as in the redis
# round-trip.
- script:
timeout: 36m
content: |
set -eu
cd ../../..
[ -x examples/backups/redis/run-all.sh ] || { echo "examples/backups/redis/run-all.sh not found or not executable" >&2; exit 1; }
APP_KIND=Valkey REDIS_NAME=valkey-bkp REDIS_RESTORE_NAME=valkey-bkp-copy \
NAMESPACE="$NAMESPACE" S3_ENDPOINT="https://seaweedfs-s3.tenant-root.svc:8333" \
examples/backups/redis/run-all.sh
check:
($error == null): true
(contains($stderr, 'To-copy restore verified')): true
finally:
- description: backup-flow cleanup
script:
timeout: 8m
content: |
set -eu
cd ../../..
APP_KIND=Valkey REDIS_NAME=valkey-bkp REDIS_RESTORE_NAME=valkey-bkp-copy \
NAMESPACE="$NAMESPACE" examples/backups/redis/cleanup.sh