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.0b3.tar.gz (76.2 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.0b3-py3-none-any.whl (104.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hop3_testing-0.4.0b3.tar.gz
  • Upload date:
  • Size: 76.2 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.0b3.tar.gz
Algorithm Hash digest
SHA256 a4d6e3783745315d1965e5f8d33251c1d19ad58fac86c9748100ef3e01bf10c4
MD5 abd35a6497f4f3f4e177c77b54b4b1ad
BLAKE2b-256 ecf445cf38131cc7d615e6fc8f2e6ac4c87c6a5bcf5cf38feef5ddc09855835f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hop3_testing-0.4.0b3-py3-none-any.whl
  • Upload date:
  • Size: 104.6 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.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 7a63782612552e0a891943aa09c131f23f5c4ca2b84436873e802ced3741a9f3
MD5 b3e7b251a81e671edd82954ef0234703
BLAKE2b-256 4f9f2f76f58a6b981d3723ef8a1a79228f18df3a30b9cf50aa1bc467474d61d1

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