Skip to main content

Provoke predictable errors in your Django projects.

Project description

Sabot: Controlled failure for Django

Logo

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-sabot, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size django-sabot-0.1.0.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page