chaostoolkit-wiremock
Chaos Toolkit driver for the WireMock service API
Package installation
To install the package from pypi.org:
pip install chaoswm
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
pip install -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
downaction
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_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"
}
}
]
}
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 chaoswm 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chaoswm-0.2.1.tar.gz | 16.4 kB | Without provenance | Details for chaoswm-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chaoswm-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for chaoswm-0.2.1-py2.py3-none-any.whl |
Total release size: 28.4 kB
Release files / chaoswm-0.2.1.tar.gz
| Download URL | chaoswm-0.2.1.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5dfa7dba3890a72e16b3a4c50e2baf6b7f6d7e2e49ec14e55293f2399a357d0
|
|
BLAKE2b-256 checksum How to use checksums |
dda83b8554ed28eab829c888509c8a42f3de61c521e7594a3e8c73d49ab99971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Release files / chaoswm-0.2.1-py2.py3-none-any.whl
| Download URL | chaoswm-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
4b0a34201faf9c5e945dae74eb259a1f674d0f752ef9291eee743843409e55a2
|
|
BLAKE2b-256 checksum How to use checksums |
59123986ad27d0f1ba082eaabb99d1da05a3db72ef4b397e92935d814e60d942
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|
Security for chaoswm 0.2.1
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.