Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock
Chaos Toolkit driver for the WireMock service API
https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock
chaos-engineering chaostoolkit chaostoolkit-extension wiremock
Last synced: 23 days ago
JSON representation
Chaos Toolkit driver for the WireMock service API
- Host: GitHub
- URL: https://github.com/chaostoolkit-incubator/chaostoolkit-wiremock
- Owner: chaostoolkit-incubator
- License: apache-2.0
- Created: 2019-06-11T08:44:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T03:57:49.000Z (almost 2 years ago)
- Last Synced: 2024-07-30T17:32:51.344Z (5 months ago)
- Topics: chaos-engineering, chaostoolkit, chaostoolkit-extension, wiremock
- Language: Python
- Size: 85 KB
- Stars: 3
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
chaostoolkit-wiremock
=====================[![Build Status](https://travis-ci.com/chaostoolkit-incubator/chaostoolkit-wiremock.svg?branch=master)](https://travis-ci.com/chaostoolkit-incubator/chaostoolkit-wiremock)
[![image](https://img.shields.io/pypi/v/chaostoolkit-wiremock.svg)](https://pypi.python.org/pypi/chaostoolkit-wiremock)[Chaos Toolkit][chaostoolkit] driver for [WireMock][wiremock].
[chaostoolkit]: http://chaostoolkit.org
[wiremock]: http://wiremock.org/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 installConfiguration
-------------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` actionConfiguration 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](https://github.com/audreyr/cookiecutter) and the
[audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage)
project template.