Skip to main content

Chaos Engineering

Enabling chaos engineering, behavior different from what is expected will be randomly inserted into the calls, such as errors and delays, with this it is possible to verify how the client behaves in unforeseen situations.

How to enable Chaos Engineering

To enable chaos it is necessary to set the 'Enabled' variable to 'true' as shown in the example below (see Configuration for more details):

"Mockaco": {
...
"Chaos": {
"Enabled": true,
},
...
},

in appsettings.json.

Types of answers with chaos

  • Behavior: Return HTTP Error 503 (Service Unavailable)
  • Exception: Return HTTP Error 500 (Internal Server Erro)
  • Latency: Randomly add delay time to a call
  • Result: Return HTTP Error 400 (Bad Request)
  • Timeout: Waits a while and returns error 408 (Request Timeout)

How to define parameters

Parameters are defined inside the Chaos key

"Mockaco": {
...
"Chaos": {
"Enabled": true,
"ChaosRate": 20,
"MinimumLatencyTime": 500,
"MaximumLatencyTime": 3000,
"TimeBeforeTimeout": 10000
},
...
},

in appsettings.json.

ParameterDescriptionDefault
EnabledOption to enable and disable chaos (true / false)false
ChaosRatePercentage of calls affected by chaos (0 - 100)20
MinimumLatencyTimeMinimum latency in milliseconds when the latency strategy is drawn500
MaximumLatencyTimeMaximum latency in milliseconds when the latency strategy is drawn3000
TimeBeforeTimeoutTime in milliseconds before timeout error10000