Skip to main content

Testing utilities for Hop3

Project description

hop3-testing

Testing framework for Hop3 deployment validation.

Overview

hop3-testing provides utilities and fixtures for testing Hop3 deployments. It supports running tests against Docker containers or remote servers, with a catalog of test applications covering various languages and frameworks.

Features

  • Multiple targets - Test against Docker containers or remote SSH servers
  • App catalog - Pre-built test applications for various languages
  • Deployment sessions - Automated deploy/verify/cleanup workflow
  • pytest fixtures - Integration with pytest for E2E testing
  • Category filtering - Run tests by language or framework

Installation

For development

# From workspace root
cd packages/hop3-testing
uv pip install -e ".[dev]"

Quick Start

# Test all apps on Docker
hop3-test --target docker

# Test specific app
hop3-test --target docker 010-flask-pip-wsgi

# Test against remote server
hop3-test --target remote --host server.example.com

# Test specific category
hop3-test --target docker --category python-simple

# List available apps
hop3-test --list-apps

Architecture

hop3-testing/
├── src/hop3_testing/
│   ├── main.py              # CLI entry point
│   ├── base.py              # Base test fixtures
│   ├── common.py            # Shared utilities
│   ├── apps/
│   │   ├── catalog.py       # App catalog management
│   │   └── deployment.py    # Deployment session handling
│   ├── targets/
│   │   ├── base.py          # Abstract target interface
│   │   ├── docker.py        # Docker container target
│   │   └── remote.py        # Remote SSH target
│   └── util/
│       ├── console.py       # Output formatting
│       └── backports.py     # Python compatibility
└── tests/

Test Targets

Docker Target

Runs tests in isolated Docker containers:

hop3-test --target docker --image ubuntu:24.04

Remote Target

Runs tests against a remote Hop3 server:

hop3-test --target remote --host server.example.com --ssh-key ~/.ssh/id_rsa

App Categories

Test applications are organized by category:

Category Languages/Frameworks
python-simple Flask, FastAPI, Django
python-complex Multi-process, workers
nodejs Express, Fastify
ruby Sinatra, Rails
go Fiber, Gin
rust Actix-web, Axum
static HTML, Hugo, Jekyll

Using with pytest

# conftest.py
from hop3_testing import DeploymentTarget, AppCatalog

@pytest.fixture(scope="session")
def deployment_target():
    """Provide a deployment target for tests."""
    return DockerTarget()

@pytest.fixture
def app_catalog():
    """Provide the test app catalog."""
    return AppCatalog()

# test_deployment.py
def test_flask_app(deployment_target, app_catalog):
    """Test Flask application deployment."""
    app = app_catalog.get("010-flask-pip-wsgi")

    with DeploymentSession(deployment_target, app) as session:
        session.deploy()
        assert session.verify_running()
        assert session.verify_http_response()

Development

Running tests

# From package directory
uv run pytest tests/ -v

# With coverage
uv run pytest tests/ --cov=hop3_testing

Code quality

uv run ruff check src/
uv run ruff format src/

Documentation

Related Packages

License

Apache-2.0 - Copyright (c) 2024-2025, Abilian SAS

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

hop3_testing-0.4.0b1.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

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

hop3_testing-0.4.0b1-py3-none-any.whl (95.3 kB view details)

Uploaded Python 3

File details

Details for the file hop3_testing-0.4.0b1.tar.gz.

File metadata

  • Download URL: hop3_testing-0.4.0b1.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for hop3_testing-0.4.0b1.tar.gz
Algorithm Hash digest
SHA256 af18869d0e2006c346bfe728016272471120dca3a1bf097af9b53efca3c8888b
MD5 18095c014483d5386f1777b4e64d6b37
BLAKE2b-256 1f92858378646d9813d1e9dac8ace07ce2d0ab854624e6e837b47cf536255daf

See more details on using hashes here.

File details

Details for the file hop3_testing-0.4.0b1-py3-none-any.whl.

File metadata

  • Download URL: hop3_testing-0.4.0b1-py3-none-any.whl
  • Upload date:
  • Size: 95.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for hop3_testing-0.4.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 78700c3877effac3a58d2935439d16e52dc70c46e5316570765fedcfd875c926
MD5 c9b0c6b9969aa80743a61f323660ce7f
BLAKE2b-256 1f3c5da27c8f70e0bd09a98789df0a75c8422b2edda40956fcc3babdbe9768a8

See more details on using hashes here.

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