Skip to main content

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

Metadata

Release files for django-sabot 0.1.0

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

Source distribution (sdist)

Source distribution for django-sabot 0.1.0
File Size Uploaded
django-sabot-0.1.0.tar.gz 4.6 kB Details

Release files / django-sabot-0.1.0.tar.gz

Download URL django-sabot-0.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bbd26e21bb031ee6e5b168564371c688e88c4b1cbb5b8b84e19080498965b5d5
BLAKE2b-256 checksum
How to use checksums
f48ffff0b5acb9b296e35e76ecd1d49565d8186aa056d6727688d866b584f38b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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