Commit 9c63384
test(redis): drive backend/redis coverage from 23.5% to 95.1% (#19)
Adds an exhaustive integration + unit test file (coverage_test.go) that
exercises every public surface of the redis provisioning backends:
- backend.go factories (NewBackend k8s success + fallback, dedicated)
plus the goredis / k8sEnv / k8sEnvInt helper aliases.
- local.go: newLocalBackend defaults, Provision against a real Redis
container (ACL SETUSER + key-prefix isolation + publicHostPort env
permutations), StorageBytes prefix-sum, Deprovision DELUSER + SCAN,
ACL-failure fallback path via a closed-port client.
- dedicated.go: provisionLocal happy + ACL-fallback paths,
localStorageBytes against real INFO memory, deprovisionLocal
canonical + legacy username probes, Upstash stubs.
- k8s.go: every applyXxx CRUD path against a fake.Clientset, all
Provision rollback branches (network policy, resource quota, secret,
pvc, service errors) via reactor injection, route-registry write +
delete error swallowing, Regrade direct-connection happy +
idempotent + unlimited-tier paths against real Redis, full
StorageBytes happy path, applyNamespace Terminating-namespace
recreate + context-cancel branches, helpers (redisK8sRandHex,
boolPtrR, redisDataVolumeSource), spdyPodExecor.ExecInPod error
path.
Real Redis dependency is gated by CUSTOMER_REDIS_URL (defaults to
localhost:6379, skips cleanly when no Redis is reachable).
Coverage: 23.5% → 95.1% on instant.dev/provisioner/internal/backend/redis.
Co-authored-by: Manas Srivastava <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5fb0b8f commit 9c63384
1 file changed
Lines changed: 1981 additions & 0 deletions
0 commit comments