Package: chaoswm
chaostoolkit-wiremockChaos Toolkit driver for the WireMock service APIPackage installationTo install the package from pypi.org:pip install chaoswmInstallation from sourceIn order to use it, you need python 3.5+ in your environment.
Once downloaded the project, cd into it and run:pip install -r requirements.txt
pip install -r requirements_dev.txt
make clean && make test && make installConfigurationThe following keys can be configured in the experiment global
configuration section, under the "wiremock" key:host: the wiremock server hostport: the wiremock server portcontextPath: the contextPath for your wiremock server (optional)timeout: accepted timeout (defaults to 1 sec)down: the delayDistribution section used by thedownactionConfiguration example:{
    "configuration": {
        "wiremock": {
            "host": "localhost",
            "port": 8080,
            "contextPath": "/wiremock",
            "timeout": 10,
            "down": {
                "type": "lognormal",
                "median": 3000,
                "sigma": 0.2
            }
        }
    }
}Exported ActionsAdding a list of mappings:{
  "method": [
    {
      "type": "action",
      "name": "adding a mapping",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "add_mapping",
          "arguments": [{
              "request": {
                  "method": "GET",
                  "url": "/some/thing"
              },
              "response": {
                  "status": 200,
                  "body": "Hello world!",
                  "headers": {
                      "Content-Type": "text/plain"
                  }
              } 
          }]
      }
    }
  ]
}Deleting a list of mappings:{
  "method": [
    {
      "type": "action",
      "name": "deleting a mapping",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "delete_mapping",
          },
          "arguments": [{
              "method": "GET",
              "url": "/some/thing"
          }]
      }
  ]
}Adding a global fixed delay:{
  "method": [
    {
      "type": "action",
      "name": "Adding a global fixed delay",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "global_fixed_delay"
          },
          "arguments": {
              "fixedDelay": 10
          }
      }
  ]
}Adding a global random delay:{
  "method": [
    {
      "type": "action",
      "name": "Adding a global random delay",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "global_random_delay"
          },
          "arguments": {
            "delayDistribution": {
                "type": "lognormal",
                "median": 20,
                "sigma": 0.1
            }
          }
      }
  ]
}Adding a fixed delay to a list of mappings:{
  "method": [
    {
      "type": "action",
      "name": "Adding a fixed delay to a mapping",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "fixed_delay"
          },
          "arguments": {[{
                  "method": "GET",
                  "url": "/some/thing"
              }],
              "fixedDelayMilliseconds": 100
          }
      }
  ]
}Adding a fixed delay to a list of mappings If a consistent number of
mappings have to be delayed, the following action might be useful:{
  "method": [
    {
      "type": "action",
      "name": "Adding a fixed delay to a set of mappings",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "fixed_delay_to_many_mappings"
          },
          "arguments": {[{
                "method": "GET",
                "url": "/some/thing",
              },{
                "method": "POST",
                "url": "/some/thing/else",
              }],
              "fixedDelayMilliseconds": 100
          }
      }
  ]
}Adding a random delay to a list of mappings:{
  "method": [
    {
      "type": "action",
      "name": "Adding a random delay to a mapping",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "random_delay"
          },
          "arguments": {[{
                  "method": "GET",
                  "url": "/some/thing",
              }],
              "delayDistribution": {
                  "type": "lognormal",
                  "median": 80,
                  "sigma": 0.4
              }
          }
      }
  ]
}Adding a ChunkedDribbleDelay to a list of mappings:{
  "method": [
    {
      "type": "action",
      "name": "Adding a ChunkedDribbleDelay to a mapping",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "chunked_dribble_delay"
          },
          "arguments": {[{
                "method": "GET",
                "url": "/some/thing",
              }],
              "chunkedDribbleDelay": {
                  "numberOfChunks": 5,
                  "totalDuration": 1000
              }
          }
      }
  ]
}Taking a list of mappings down (heavy distribution delay). This action
will use the parameters specified in the "down" key of the
configuration section:{
  "method": [
    {
      "type": "action",
      "name": "Taking a mapping down",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "down"
          },
          "arguments": [{
              "method": "GET",
              "url": "/some/thing",
          }]
      }
  ]
}Taking a list of mappings up back again:{
  "method": [
    {
      "type": "action",
      "name": "Taking a mapping down",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "up"
          },
          "arguments": [{
              "method": "GET",
              "url": "/some/thing",
          }]
      }
  ]
}Resetting the wiremock server (deleting all mappings):{
  "method": [
    {
      "type": "action",
      "name": "Taking a mapping down",
      "provider": {
          "type": "python",
          "module": "chaoswm.actions",
          "func": "reset"
      }
    }
  ]
}DiscoveryYou may use the Chaos Toolkit to discover the capabilities of this
extension:$ chaos discover chaostoolkit-wiremock  --no-installCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.