Provoke predictable errors in your Django projects.
Project description
Sabot: Controlled failure for Django
Description
Provoke predictable errors in your Django projects. Raise OperationalErrors to see how well your project handle database connection errors. Ideal for failure tolerance testing.
License
This project is open sourced under the MIT License.
Installation
$ pip install django-sabot
Add 'sabot', to your project’s INSTALLED_APPS list.
Add some sabot patches in your settings.py file.
Usage
In you settings.py file:
from django.db import OperationalError from sabot.import * SABOT_PATCHES = ( ConnectPatcher(error_generator=RandomErrorProducer, kwargs={'low': 1, 'high': 3}), CursorPatcher(error_producer=RandomErrorProducer, kwargs={'exception': OperationalError, 'low': 1, 'high': 10}), CursorPatcher(error_producer=CountErrorProducer, kwargs={'exception': OperationalError, 'number': 100, 'reset': True}), CursorPatcher(error_producer=TimeDeltaErrorProducer, kwargs={'exception': OperationalError, 'timedelta': {'seconds': 30}, 'reset': True}), )
A django-sabot patch is composed of a monkey patcher class and an error producer class.
For example:
CursorPatcher(error_producer=TimeDeltaErrorProducer, kwargs={'exception': OperationalError, 'timedelta': {'seconds': 30}, 'reset': True}),
will produce an OperationalError when a database cursor is requested, every 30 seconds.
Contribute
Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
Write a test which shows that the bug was fixed or that the feature works as expected.
Make sure to add yourself to the AUTHORS file.
Send a pull request
0.1.0 (2015-07-20)
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-sabot-0.1.0.tar.gz
.
File metadata
- Download URL: django-sabot-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbd26e21bb031ee6e5b168564371c688e88c4b1cbb5b8b84e19080498965b5d5 |
|
MD5 | b620e2fac8d48fca26fce86764754352 |
|
BLAKE2b-256 | f48ffff0b5acb9b296e35e76ecd1d49565d8186aa056d6727688d866b584f38b |