This test validates the Redis cache contract for video caches:
Before running the test, ensure:
The test uses .env.mgnt.test for configuration. Update the following variables if needed:
# MongoDB connection (ensure user exists and has correct permissions)
MONGO_URL="mongodb://boxuser:PASSWORD@localhost:27017/box_admin?authSource=admin"
MONGO_STATS_URL="mongodb://boxstatuser:PASSWORD@localhost:27017/box_stats?authSource=admin"
# Redis connection
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_DB=0
If you see SCRAM failure: Authentication failed:
Option A: Create the MongoDB user:
mongosh admin
db.createUser({
user: "boxuser",
pwd: "YOUR_PASSWORD",
roles: [{ role: "readWrite", db: "box_admin" }]
})
Option B: Update .env.mgnt.test to use your existing MongoDB credentials
Option C: Use connection string without authentication:
MONGO_URL="mongodb://localhost:27017/box_admin"
# From box-nestjs-monorepo directory
pnpm test:e2e:mgnt
Successful test output includes:
✅ Redis connection verified
🗑️ Deleted cache keys: { ... }
🔨 Rebuilding video caches...
📋 Found X category video list keys
📋 Found X tag-filtered video list keys
📋 Found X tag metadata list keys
✅ All cache keys validated successfully!
The test performs these validations:
listlistid, name, seq, status, channelId, categoryIdIf test shows Found 0 category video list keys:
MongoDB has no data - run seed scripts:
pnpm prisma:seed:mongo:test
If test exceeds 60 seconds:
If expect(pong).toBe('PONG') fails:
redis-cli ping.env.mgnt.test