Kent - Fake Sentry server for local development, debugging, and integration testing

Related tags

Testingkent
Overview

Kent

Kent is a service for debugging and integration testing Sentry.

Code: https://github.com/willkg/kent/
Issues: https://github.com/willkg/kent/issues
License: MPL v2

Goals

Goals of Kent:

  1. make it possible to debug before_send and before_breadcrumb sanitization code when using sentry-sdk
  2. make it possible to debug other sentry error submission payload issues
  3. make it possible to write integration tests against a fake sentry instance

Quick start

Installing and running on your local machine

  1. Install Kent.

    You can install Kent from PyPI with pipx or pip or whatever:

    pipx install kent
    

    You can install a REVISH ("main", branch name, commit, whatever) from GitHub:

    pipx install https://github.com/willkg/kent/archive/refs/heads/
        .zip
    
       

    You can install from a checked out version of this repository:

    pipx install .
    
  2. Run Kent:

    kent-server run [-h HOST] [-p PORT]
    

Running in a Docker container

I'm using something like this:

FROM python:3.10.1-alpine3.15

WORKDIR /app/

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

RUN pip install -U 'pip>=8' && \
    pip install --no-cache-dir 'kent==VERSION'

USER guest

ENTRYPOINT ["/usr/local/bin/kent-server"]
CMD ["run"]

Replace VERSION with the version of Kent you want to use. See https://pypi.org/project/kent for releases.

Then:

$ docker build -t faksentry:latest .
$ docker run --rm --publish 8000:8000 fakesentry:latest run --host 0.0.0.0 --port 8000

Things to know about Kent

Kent is the fakest of fake Sentry servers. It supports a single Sentry project with id 1. You can set up a Sentry DSN to point to Kent and have your application send errors.

Kent is a refined fake Sentry service and doesn't like fast food.

Kent will keep track of the last 100 it received in memory. Nothing is persisted to disk.

You can access the list of errors and error data with your web browser by going to Kent's index page.

You can also access it with the API. This is most useful for integration tests that want to assert things about errors.

/api/errorlist/
List of all errors in memory with a unique error id.
/api/error/ERRORID
Retrieve the payload for a specific error by id.
/api/flush/
Flushes the error manager of all errors.

Kent definitely works with:

  • Python sentry-sdk client

I don't know about anything else. If you use Kent with another Sentry client, add an issue with details or a pull request to update the README.

Release process

  1. Check out main tip.

  2. Update __version__ in src/kent/__init__.py.

  3. Run:

    $ make checkrot
    $ make test
    $ make testdocker
    $ check-manifest
    

    Fix any issues from that.

  4. Update HISTORY.rst.

  5. Push any changes to GitHub.

  6. Release:

    $ git tag --sign 1.0.0
    # Use contents from HISTORY.rst for tag comment
    
    $ make clean
    $ python setup.py sdist bdist_wheel
    $ twine upload dist/*
    
Owner
Will Kahn-Greene
he/him; crash ingestion, python tools, etc
Will Kahn-Greene
A framework-agnostic library for testing ASGI web applications

async-asgi-testclient Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3). The motiva

122 Nov 22, 2022
Python Projects - Few Python projects with Testing using Pytest

Python_Projects Few Python projects : Fast_API_Docker_PyTest- Just a simple auto

Tal Mogendorff 1 Jan 22, 2022
Pyramid debug toolbar

pyramid_debugtoolbar pyramid_debugtoolbar provides a debug toolbar useful while you're developing your Pyramid application. Note that pyramid_debugtoo

Pylons Project 95 Sep 17, 2022
AllPairs is an open source test combinations generator written in Python

AllPairs is an open source test combinations generator written in Python

Robson Agapito Correa 5 Mar 05, 2022
Travel through time in your tests.

time-machine Travel through time in your tests. A quick example: import datetime as dt

Adam Johnson 373 Dec 27, 2022
Donors data of Tamil Nadu Chief Ministers Relief Fund scrapped from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport

Tamil Nadu Chief Minister's Relief Fund Donors Scrapped data from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport Scrapper scrapper.p

Arunmozhi 5 May 18, 2021
This file will contain a series of Python functions that use the Selenium library to search for elements in a web page while logging everything into a file

element_search with Selenium (Now With docstrings 😎 ) Just to mention, I'm a beginner to all this, so it it's very possible to make some mistakes The

2 Aug 12, 2021
buX Course Enrollment Automation

buX automation BRACU - buX course enrollment automation Features: Automatically enroll into multiple courses at a time. Find courses just entering cou

Mohammad Shakib 1 Oct 06, 2022
How to Create a YouTube Bot that Increases Views using Python Programming Language

YouTube-Bot-in-Python-Selenium How to Create a YouTube Bot that Increases Views using Python Programming Language. The app is for educational purpose

Edna 14 Jan 03, 2023
Python program that uses pynput to simulate key presses. Probably only works on Windows.

AutoKey Python program that uses pynput to simulate key presses. Probably only works on Windows. Can be used for pretty much whatever you want except

2 Oct 28, 2022
Code coverage measurement for Python

Coverage.py Code coverage testing for Python. Coverage.py measures code coverage, typically during test execution. It uses the code analysis tools and

Ned Batchelder 2.3k Jan 04, 2023
A library for generating fake data and populating database tables.

Knockoff Factory A library for generating mock data and creating database fixtures that can be used for unit testing. Table of content Installation Ch

Nike Inc. 30 Sep 23, 2022
A rewrite of Python's builtin doctest module (with pytest plugin integration) but without all the weirdness

The xdoctest package is a re-write of Python's builtin doctest module. It replaces the old regex-based parser with a new abstract-syntax-tree based pa

Jon Crall 174 Dec 16, 2022
A mocking library for requests

httmock A mocking library for requests for Python 2.7 and 3.4+. Installation pip install httmock Or, if you are a Gentoo user: emerge dev-python/httm

Patryk Zawadzki 452 Dec 28, 2022
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

Teemu 963 Dec 28, 2022
Tutorial for integrating Oxylabs' Residential Proxies with Selenium

Oxylabs’ Residential Proxies integration with Selenium Requirements For the integration to work, you'll need to install Selenium on your system. You c

Oxylabs.io 8 Dec 08, 2022
The definitive testing tool for Python. Born under the banner of Behavior Driven Development (BDD).

mamba: the definitive test runner for Python mamba is the definitive test runner for Python. Born under the banner of behavior-driven development. Ins

Néstor Salceda 502 Dec 30, 2022
ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries.

ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries. With this f

Mustafa 1 Jul 11, 2022
pytest plugin to test mypy static type analysis

pytest-mypy-testing — Plugin to test mypy output with pytest pytest-mypy-testing provides a pytest plugin to test that mypy produces a given output. A

David Fritzsche 21 Dec 21, 2022
Docker-based integration tests

Docker-based integration tests Description Simple pytest fixtures that help you write integration tests with Docker and docker-compose. Specify all ne

Avast 326 Dec 27, 2022