A specialized HTTP API mock server designed for microservices developers to simulate complex service mesh environments. This implementation focuses on mocking multiple interdependent services, service discovery patterns, and distributed system behaviors to enable comprehensive testing of microservices architectures.
A developer working on microservices who needs to mock multiple interdependent services. She requires service mesh simulation to test complex service interaction patterns and failure cascades.
-
Service dependency graph visualization and simulation
- Critical for understanding and testing complex service relationships
- Enables validation of service communication patterns and dependencies
-
Circuit breaker behavior emulation with failure thresholds
- Essential for testing resilience patterns in distributed systems
- Allows verification of graceful degradation and recovery mechanisms
-
Service discovery endpoint mocking with dynamic registration
- Vital for testing service registration and discovery workflows
- Enables validation of dynamic service mesh behaviors
-
Distributed tracing header propagation and visualization
- Required for testing observability implementations
- Ensures proper trace context propagation across service boundaries
-
Chaos engineering scenarios for cascade failure testing
- Critical for validating system resilience under failure conditions
- Enables testing of failure isolation and recovery strategies
- All service mesh behaviors must be programmable
- Service dependencies must be dynamically configurable
- Chaos scenarios must be reproducible and deterministic
- Distributed tracing must be verifiable
- Support for 50+ mock services simultaneously
- Service discovery updates within 100ms
- Circuit breaker state changes within 50ms
- Trace header processing with minimal overhead (<5ms)
- Service registry API for dynamic service management
- Circuit breaker configuration and monitoring APIs
- Distributed tracing context APIs
- Chaos engineering control plane
- Implementation must be pure Python with no UI components
- All functionality must be testable via pytest
- Must support standard service mesh protocols
- Should work with common tracing standards (OpenTelemetry, Jaeger)
IMPORTANT: The implementation should have NO UI/UX components. All functionality must be implemented as testable Python modules and classes that can be thoroughly tested using pytest. Focus on creating well-defined APIs and interfaces rather than user interfaces.
The mock server must provide:
-
Service Dependency Manager: A system for defining and managing complex service dependency graphs with support for synchronous and asynchronous communication patterns.
-
Circuit Breaker Engine: Implementation of circuit breaker patterns with configurable failure thresholds, timeout periods, and half-open states for each service endpoint.
-
Service Registry: Dynamic service discovery simulation with registration, deregistration, health checking, and metadata management capabilities.
-
Distributed Tracing System: Complete trace context propagation following standards like W3C Trace Context, with span creation and correlation across services.
-
Chaos Controller: Controlled failure injection including service outages, network partitions, latency spikes, and cascade failure scenarios.
- Service dependencies are correctly modeled and enforced
- Circuit breakers transition states appropriately
- Service discovery reflects dynamic changes
- Trace context propagates correctly across services
- Chaos scenarios create expected failure patterns
- Testing service communication in complex topologies
- Validating circuit breaker protection mechanisms
- Verifying service discovery during scaling events
- Ensuring trace continuity across service calls
- Testing system resilience to cascade failures
- Handle 50+ mock services concurrently
- Service registration/discovery under 100ms
- Circuit breaker decisions under 50ms
- Trace overhead below 5ms per request
- Support 1000+ requests/second across all services
- Circular service dependencies
- Circuit breaker flapping conditions
- Service discovery during network partitions
- Trace context corruption or loss
- Simultaneous failures across multiple services
- Minimum 90% code coverage for all core modules
- 100% coverage for circuit breaker logic
- Integration tests for service mesh scenarios
- Chaos testing validation
- End-to-end tests for distributed workflows
IMPORTANT:
- ALL functionality must be testable via pytest without any manual intervention
- Tests should verify behavior against requirements, not implementation details
- Tests should be designed to validate the WHAT (requirements) not the HOW (implementation)
- Tests should be comprehensive enough to verify all aspects of the requirements
- Tests should not assume or dictate specific implementation approaches
- REQUIRED: Tests must be run with pytest-json-report to generate a pytest_results.json file:
pip install pytest-json-report pytest --json-report --json-report-file=pytest_results.json - The pytest_results.json file must be included as proof that all tests pass
The implementation will be considered successful when:
- Complex microservices topologies can be accurately simulated
- Resilience patterns work correctly under failure conditions
- Service discovery behaves realistically
- Distributed tracing provides complete visibility
- Chaos engineering reveals system weaknesses effectively
REQUIRED FOR SUCCESS:
- All tests must pass when run with pytest
- A valid pytest_results.json file must be generated showing all tests passing
- The implementation must satisfy all key requirements specified for this persona
To set up the development environment:
- Create a virtual environment using
uv venvfrom within the project directory - Activate the environment with
source .venv/bin/activate - Install the project in editable mode with
uv pip install -e . - Install test dependencies including pytest-json-report
The final implementation must be validated by:
- Running all tests with pytest-json-report
- Generating and providing the pytest_results.json file
- Demonstrating all five key requirements are fully implemented
- Showing effective microservices testing capabilities
CRITICAL: Running tests with pytest-json-report and providing the pytest_results.json file is MANDATORY for project completion.