Test Environment
Environment tiers chuẩn
- Local — dev laptop.
- Dev shared — integration with team's branches.
- Staging — pre-prod, prod-like data.
- UAT — client / stakeholder review.
- Performance — isolated for load test.
- Production — live users.
Test data strategy
- Anonymized prod copy — realistic but GDPR/ATTT compliant.
- Synthetic data — generated, no PII.
- Seed data — fixed dataset for repeatable test.
- Live data with feature flag — production but feature gated.
Common issues
- Staging different from prod → bug found only in prod.
- Test data stale → tests fail.
- Concurrent QA blow up shared data.
- Database state leak between test runs.
Best practice
- Infrastructure as Code (Terraform).
- Containerize environment (Docker Compose).
- Ephemeral environments per PR (branch deployments).
- Daily data refresh from prod snapshot (anonymized).
- Reset endpoints (test-only API to clear state).
VN context
Banking: physical isolated test environment regulatory. Air-gap from prod.
E-com: ephemeral PR env phổ biến (Vercel, AWS Amplify).
Cost optimization
- Spin down dev env nights/weekends.
- Smaller instances for test (RAM 2GB vs prod 32GB).
- Spot instance cho performance test.
Documentation
- Env URL list trong README.
- Credential rotation schedule.
- Reset procedure documented.