Complete the code to define the main goal of chaos engineering.
chaos_engineering_goal = "[1]"
The main goal of chaos engineering is to improve system resilience by intentionally testing failures in a controlled way.
Complete the code to identify a common tool used in chaos engineering for microservices.
common_chaos_tool = "[1]"
Chaos Monkey is a popular tool used to randomly terminate instances in microservices to test system resilience.
Fix the error in the code that simulates a failure injection in a microservice.
def inject_failure(service): if service.status == 'healthy': service.status = '[1]' return service.status
To simulate failure, the service status should be set to 'failed'.
Fill both blanks to create a dictionary comprehension that maps microservice names to their failure status if they are unhealthy.
failure_map = {service.name: service.status for service in services if service.status [1] '[2]'}The comprehension filters services whose status is not equal to 'healthy', mapping their names to their status.
Fill all three blanks to create a function that triggers chaos experiments only if the system is stable and the experiment is approved.
def trigger_chaos(system_status, experiment_approved): if system_status [1] 'stable' and experiment_approved [2] True: return '[3]' else: return 'Do not run experiment'
The function checks if the system status equals 'stable' and the experiment is approved (True), then returns 'Run experiment'.