Skip to content

RFC: Scenario Definition

Ian Joyce edited this page Feb 11, 2022 · 20 revisions

Summary

This is an RFC to define the configuration format for scenarios.

Motivation

Allow for a configuration format that allows for simple and complex scenarios based on HTTP request path, query and headers.

Detailed Design

Scenario Definition

Name Description
name Human readable name.
failure_type The type of failure to inject. Valid values are: Error, Delay or Timeout.
frequency How frequent to inject a failure. Valid values are between 0 and 1.
delay Optionally add a delay in ms before the failure. Valid values are > 0.
matches The criteria that must be met in order for a failure to be injected.

Match Definition

Name Description
match_type The type of match. Valid values are Path, Query, Header and Cookie.
key The key to either the Header or Cookie to look for a match.
value The value of the Path, Query, Header or Cookie to use for a match.

Examples

Inject failure 50% of the time for all requests to /products/123.

scenarios:
- name: Product error
  failure_type: Error
  frequency: 0.5
  delay: 300
  matches:
  - match_type: Path
    value: /products/123

Inject failure 100% of the time for all requests containing a cookie with the key of X-Failure and a value of 1.

scenarios:
- name: Trigger Error for X-Failure cookie.
  failure_type: Error
  frequency: 1.0
  delay: 300
  matches:
  - match_type: Cookie
    key: X-Failure
    value: 1

Inject failure 10% of the time for all requests containing a query named redirect=true.

scenarios:
- name: Redirect delay
  failure_type: Delay
  frequency: 0.1
  delay: 3000
  matches:
  - match_type: Query
    value: redirect=true

Inject failure 100% of time for all requests to / and containing a cookie with the key of UserId and a value of user1234567789.

scenarios:
- name: Cause issues for user 123456789
  failure_type: Timeout
  frequency: 1.0
  delay: 1000
  matches:
  - match_type: Cookie
    key: UserId
    value: user123456789
  • A more complex configuration with multiple scenarios and matches.
scenarios:
- name: Trigger Error for X-Failure cookie.
  failure_type: Error
  frequency: 1.0
  delay: 300
  matches:
  - match_type: Cookie
    key: X-Failure
    value: 1
- name: Cause issues for user 123456789 at /products/123
  failure_type: Timeout
  frequency: 1.0
  delay: 1000
  matches:
  - match_type: Cookie
    key: UserId
    value: user123456789
  - type: Path
    value: /products/123

Open Questions

  • Should HTTP method be a matcher?
  • Should HTTP version be a matcher?