--------|----------|--------|----------| | PostgreSQL | Connection Loss | PASS | Yes | | PostgreSQL | High Latency | PASS | Yes | | PostgreSQL | Network Partition | PASS | Yes | | Redis | Connection Loss | PASS | Yes | | Redis | High Latency | PASS | Yes | | Redis | Network Partition | PASS | Yes |
## Handoff to Next Gate - Ready for Gate 8 (Code Review): YES
Dev Chaos Testing (Gate 7)
Overview
Ensure code handles failure conditions gracefully by injecting faults using Toxiproxy. Verify connection loss, latency, and network partitions don't cause crashes.
Core principle: All infrastructure fails. Chaos testing ensures your code handles it gracefully.
<block_condition>
- •No chaos tests = FAIL
- •Any dependency without failure test = FAIL
- •Recovery not verified = FAIL
- •System crashes on failure = FAIL </block_condition>
CRITICAL: Role Clarification
This skill ORCHESTRATES. QA Analyst Agent (chaos mode) EXECUTES.
| Who | Responsibility |
|---|---|
| This Skill | Gather requirements, dispatch agent, track iterations |
| QA Analyst Agent | Write chaos tests, setup Toxiproxy, verify recovery |
Standards Reference
MANDATORY: Load testing-chaos.md standards via WebFetch.
<fetch_required> https://raw.githubusercontent.com/LerianStudio/ring/main/dev-team/docs/standards/golang/testing-chaos.md </fetch_required>
Step 1: Validate Input
REQUIRED INPUT: - unit_id: [task/subtask being tested] - external_dependencies: [postgres, redis, rabbitmq, etc.] - language: [go|typescript] OPTIONAL INPUT: - gate6_handoff: [full Gate 6 output] if any REQUIRED input is missing: → STOP and report: "Missing required input: [field]" if external_dependencies is empty: → STOP and report: "No external dependencies found - chaos testing requires dependencies"
Step 2: Dispatch QA Analyst Agent (Chaos Mode)
Task tool:
subagent_type: "ring:qa-analyst"
model: "opus"
prompt: |
**MODE:** CHAOS TESTING (Gate 7)
**Standards:** Load testing-chaos.md
**Input:**
- Unit ID: {unit_id}
- External Dependencies: {external_dependencies}
- Language: {language}
**Requirements:**
1. Setup Toxiproxy infrastructure in tests/utils/chaos/
2. Create chaos tests (TestIntegration_Chaos_{Component}_{Scenario} naming)
3. Use dual-gate pattern (CHAOS=1 env + testing.Short())
4. Test failure scenarios: Connection Loss, High Latency, Network Partition
5. Verify 5-phase structure: Normal → Inject → Verify → Restore → Recovery
**Output Sections Required:**
- ## Chaos Testing Summary
- ## Failure Scenarios
- ## Handoff to Next Gate
Step 3: Evaluate Results
Parse agent output: if "Status: PASS" in output: → Gate 7 PASSED → Return success with metrics if "Status: FAIL" in output: → Dispatch fix to implementation agent → Re-run chaos tests (max 3 iterations) → If still failing: ESCALATE to user
Step 4: Generate Output
## Chaos Testing Summary
**Status:** {PASS|FAIL}
**Dependencies Tested:** {count}
**Scenarios Tested:** {count}
**Recovery Verified:** {Yes|No}
## Failure Scenarios
| Component | Scenario | Status | Recovery |
|-----------|----------|--------|----------|
| {component} | {scenario} | {PASS|FAIL} | {Yes|No} |
## Handoff to Next Gate
- Ready for Gate 8 (Code Review): {YES|NO}
- Iterations: {count}
Failure Scenarios by Dependency
| Dependency | Required Scenarios |
|---|---|
| PostgreSQL | Connection Loss, High Latency, Network Partition |
| Redis | Connection Loss, High Latency, Timeout |
| RabbitMQ | Connection Loss, Network Partition, Slow Consumer |
| HTTP APIs | Timeout, 5xx Errors, Connection Refused |
Anti-Rationalization Table
| Rationalization | Why It's WRONG | Required Action |
|---|---|---|
| "Infrastructure is reliable" | AWS, GCP, Azure all have outages. Your code must handle them. | Write chaos tests |
| "Integration tests cover failures" | Integration tests verify happy path. Chaos tests verify failure handling. | Write chaos tests |
| "Toxiproxy is complex" | One container. 20 minutes setup. Prevents production incidents. | Write chaos tests |
| "We have monitoring" | Monitoring detects problems. Chaos testing prevents them. | Write chaos tests |
| "Circuit breakers handle it" | Circuit breakers need testing too. Chaos tests verify they work. | Write chaos tests |