Skip to main content

Chaos Toolkit extension for the fault proxy

Project description

Chaos Toolkit Extension For The Fault Proxy

Version License

Build, Test, and Lint Python versions

Chaos Toolkit extension to manage fault network proxy.

Install

This package requires Python 3.10+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

pip install chaostoolkit-fault

Make sure to install the fault cli and make it available in your PATH.

Usage

{
    "title": "Increase latency by 150ms",
    "description": "n/a",
    "method": [
        {
            "type": "action",
            "name": "run fault proxy with a normal distribution latency",
            "provider": {
                "type": "python",
                "module": "chaosfault.actions",
                "func": "run_proxy",
                "arguments": {
                    "proxy_args": "--with-latency --latency-mean 300 --latency-stddev 50 --upstream '*'"
                }
            },
            "background": true
        },
        {
            "type": "action",
            "name": "query remote upstream",
            "provider": {
                "type": "process",
                "path": "curl",
                "arguments": "-I -o /dev/null -s -w \"Connected IP: %{remote_ip}\nTotal time: %{time_total}s\" -x http://localhost:8080 https://www.google.com"
            }
        },
        {
            "type": "action",
            "name": "stop proxy",
            "provider": {
                "type": "python",
                "module": "chaosfault.actions",
                "func": "stop_proxy"
            }
       }
    ]
}

or you can run with a limited duration:

{
    "title": "Increase latency by 150ms",
    "description": "n/a",
    "method": [
        {
            "type": "action",
            "name": "run fault proxy with a normal distribution latency",
            "provider": {
                "type": "python",
                "module": "chaosfault.actions",
                "func": "run_proxy",
                "arguments": {
                    "proxy_args": "--duration 30s --with-latency --latency-mean 300 --latency-stddev 50 --upstream '*'"
                }
            },
            "background": true
        },
        {
            "type": "action",
            "name": "query remote upstream",
            "provider": {
                "type": "process",
                "path": "curl",
                "arguments": "-I -o /dev/null -s -w \"Connected IP: %{remote_ip}\nTotal time: %{time_total}s\" -x http://localhost:8080 https://www.google.com"
            }
        }
    ]
}

That's it!

Please explore the code to see existing actions.

Test

To run the tests for the project execute the following:

pdm run test

Formatting and Linting

We use ruff to both lint and format this repositories code.

Before raising a Pull Request, we recommend you run formatting against your code with:

pdm run format

This will automatically format any code that doesn't adhere to the formatting standards.

As some things are not picked up by the formatting, we also recommend you run:

pdm run lint

To ensure that any unused import statements/strings that are too long, etc. are also picked up.

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual code style, sprinkling with tests and submit a PR for review.

To contribute to this project, you will also need to install pdm.

Project details


Download files

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

Source Distribution

chaostoolkit_fault-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chaostoolkit_fault-0.1.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file chaostoolkit_fault-0.1.1.tar.gz.

File metadata

  • Download URL: chaostoolkit_fault-0.1.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for chaostoolkit_fault-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f84653f1397bb641424c54d4e5355660dba3d243a2666d6b8ce805ac9ded31d
MD5 0887e1d0c22a0280d730851b7fc52788
BLAKE2b-256 2d59f0e8d1990f8819f54cdb123d1cd178c46e1992e61bb9c83ad0d672dbe596

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaostoolkit_fault-0.1.1.tar.gz:

Publisher: release.yaml on chaostoolkit-incubator/chaostoolkit-fault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chaostoolkit_fault-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chaostoolkit_fault-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 313b4bb9d088a8d4820089378548039825187e87d06742702668f41b77f0f9eb
MD5 a558374726af9ba5c287f6ca7716c2fb
BLAKE2b-256 fab3e5ffd602cc34c3983a4cfcffa9177b87e3a497c2ced06ea96e630026bcc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaostoolkit_fault-0.1.1-py3-none-any.whl:

Publisher: release.yaml on chaostoolkit-incubator/chaostoolkit-fault

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page