Requirements (clarify): CI must provision isolated, realistic datasets per test run; preserve privacy (compliance), be fast and repeatable, and avoid duplicating large storage.
High-level architecture:
- Central Test Data Manager (TDM) service + Storage layer (object store + DB snapshots) + Masking/Seeding pipeline + CI plugin/agent.
APIs (REST/HTTP + gRPC):
- POST /provision {template_id, branch, snapshot_tag, ttl, overrides} → returns dataset_id, mount info, credentials
- GET /status/{dataset_id}
- POST /release/{dataset_id}
- POST /snapshot {dataset_id, name, description}
- GET /templates, POST /templates (define schemas & masking rules)
Seeding strategies:
- Template-driven seeding: small canonical seed + deterministic generators (faker with seeded RNG) for repeatability.
- Hybrid sampling: store compressed anonymized statistic profiles (value distributions, foreign key patterns) and synthesize realistic records matching those distributions.
- Referential integrity enforced via constraint-aware generators.
Masking & anonymization:
- Deterministic pseudonymization for repeatability (HMAC with environment key) for identifiers.
- Differentially private aggregate release for analytics-like fields where needed.
- Tokenization/format-preserving encryption for PII (SSN, emails) to keep valid formats.
- Rule engine per-field (hash, shuffle within bucket, replace with generated value, redact) stored in template.
Snapshotting & storage efficiency:
- Use copy-on-write snapshots for DBs (e.g., filesystem snapshots, ZFS, cloud DB snapshots) and container volumes.
- Store compressed base snapshots and patch deltas; for object store use content-addressed chunks to dedupe.
- Lazy provisioning: mount snapshot and apply lightweight overlay with per-run small changes.
Performance & scale:
- Cache warm snapshots and pre-warm generators for popular templates.
- TTL + reclamation; allow ephemeral mounting into CI runners via NFS/CSI or ephemeral DB instances.
Trade-offs:
- Fully synthetic data maximizes privacy but can miss edge cases; keep small real-derived profiles for fidelity.
- Deterministic masking trades some privacy for repeatability; rotate keys and audit access.
Observability & governance:
- Audit logs, template approvals, masking rule versioning, compliance reports.
This design balances realism, privacy, speed, repeatability, and storage efficiency for CI integration tests.