Skip to main content

chaostoolkit-wiremock

Build Status image

Chaos Toolkit driver for WireMock.

Package installation

To install the package from pypi.org:

pip install -U chaostoolkit-wiremock

Installation from source

In 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 -r requirements-dev.txt
make clean && make test && make install

Configuration

The following keys can be configured in the experiment global configuration section, under the "wiremock" key:

  • host: the wiremock server host
  • port: the wiremock server port
  • contextPath: the contextPath for your wiremock server (optional)
  • timeout: accepted timeout (defaults to 1 sec)
  • down: the delayDistribution section used by the down action

Configuration example:

{
    "configuration": {
        "wiremock": {
            "host": "localhost",
            "port": 8080,
            "contextPath": "/wiremock",
            "timeout": 10,
            "down": {
                "type": "lognormal",
                "median": 3000,
                "sigma": 0.2
            }
        }
    }
}

Exported Actions

Adding a list of mappings:

{
  "method": [
    {
      "type": "action",
      "name": "adding a mapping",
      "provider": {
        "type": "python",
        "module": "chaoswm.actions",
        "func": "add_mappings",
        "arguments": {
          "mappings": [{
            "request": {
               "method": "GET",
               "url": "/hello"
            },
            "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_mappings",
        "arguments": {
          "filter": [{
             "method": "GET",
             "url": "/hello"
          }]
        }
      }
    }
  ]
}

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": {
          "filter": [{
            "method": "GET",
            "url": "/hello1"
          }],
          "fixedDelayMilliseconds": 1000
        }
      }
    }
  ]
}

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": {
          "filter": [{
            "method": "GET",
            "url": "/hello2"
          }],
          "delayDistribution": {
            "type": "lognormal",
            "median": 2000,
            "sigma": 0.5
          }
        }
      }
    }
  ]
}

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": {
          "filter": [{
            "method": "GET",
            "url": "/hello"
          }],
          "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": {
          "filter": [{
            "method": "GET",
            "url": "/hello"
          }]
        }
      }
    }
  ]
}

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": {
          "filter": [{
            "method": "GET",
            "url": "/hello"
          }]
        }
      }
    }
  ]
}

Resetting the wiremock server (deleting all mappings):

{
  "method": [
    {
      "type": "action",
      "name": "Taking a mapping down",
      "provider": {
        "type": "python",
        "module": "chaoswm.actions",
        "func": "reset"
      }
    }
  ]
}

Experiments

The driver comes with an experiments directory where you can find snippets to test all APIs against a WireMock server listening on localhost:8080.

Discovery

You may use the Chaos Toolkit to discover the capabilities of this extension:

$ chaos discover chaostoolkit-wiremock  --no-install

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Metadata

Release files for chaostoolkit-wiremock 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chaostoolkit-wiremock 0.1.2
File Size Uploaded Provenance Actions
chaostoolkit-wiremock-0.1.2.tar.gz 16.7 kB Without provenance Details for chaostoolkit-wiremock-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chaostoolkit-wiremock 0.1.2
File Interpreter ABI Platform Actions
chaostoolkit_wiremock-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for chaostoolkit_wiremock-0.1.2-py2.py3-none-any.whl

Total release size: 29.2 kB

Release files / chaostoolkit-wiremock-0.1.2.tar.gz

Download URL chaostoolkit-wiremock-0.1.2.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
796870fe88b407eabddc4c46170a6b663aabddb740a57cb0d79ab9c019341abc
BLAKE2b-256 checksum
How to use checksums
b8fb128bb4e0b8beb681e1b98a0d38eeab4dd6e684a9054772563e2dbdc26e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.5.6

Release files / chaostoolkit_wiremock-0.1.2-py2.py3-none-any.whl

Download URL chaostoolkit_wiremock-0.1.2-py2.py3-none-any.whl
Size 12.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5b6451edcf0de19f8787dc54d4f52822477d9589165149f87f80c67a190a3aae
BLAKE2b-256 checksum
How to use checksums
4eef009afedb80b609c5619b93dc725cab6c95ef28252ff2285b25c60f21c9e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.5.6

Security for chaostoolkit-wiremock 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page