hop3-testing 0.4.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. hop3_testing-0.4.0b1/PKG-INFO +178 -0
  2. hop3_testing-0.4.0b1/README.md +158 -0
  3. hop3_testing-0.4.0b1/pyproject.toml +40 -0
  4. hop3_testing-0.4.0b1/src/hop3_testing/__init__.py +20 -0
  5. hop3_testing-0.4.0b1/src/hop3_testing/apps/__init__.py +23 -0
  6. hop3_testing-0.4.0b1/src/hop3_testing/apps/catalog.py +34 -0
  7. hop3_testing-0.4.0b1/src/hop3_testing/apps/debug.py +277 -0
  8. hop3_testing-0.4.0b1/src/hop3_testing/apps/deployment.py +501 -0
  9. hop3_testing-0.4.0b1/src/hop3_testing/apps/preparation.py +141 -0
  10. hop3_testing-0.4.0b1/src/hop3_testing/apps/verification.py +322 -0
  11. hop3_testing-0.4.0b1/src/hop3_testing/catalog/__init__.py +47 -0
  12. hop3_testing-0.4.0b1/src/hop3_testing/catalog/loader.py +299 -0
  13. hop3_testing-0.4.0b1/src/hop3_testing/catalog/models.py +304 -0
  14. hop3_testing-0.4.0b1/src/hop3_testing/catalog/scanner.py +317 -0
  15. hop3_testing-0.4.0b1/src/hop3_testing/cli/__init__.py +56 -0
  16. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/__init__.py +45 -0
  17. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/build.py +139 -0
  18. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/catalog.py +96 -0
  19. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/modes.py +95 -0
  20. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/run.py +138 -0
  21. hop3_testing-0.4.0b1/src/hop3_testing/cli/commands/test.py +360 -0
  22. hop3_testing-0.4.0b1/src/hop3_testing/cli/helpers.py +87 -0
  23. hop3_testing-0.4.0b1/src/hop3_testing/cli/reports.py +524 -0
  24. hop3_testing-0.4.0b1/src/hop3_testing/cli/runners.py +271 -0
  25. hop3_testing-0.4.0b1/src/hop3_testing/diagnostics.py +540 -0
  26. hop3_testing-0.4.0b1/src/hop3_testing/results/__init__.py +25 -0
  27. hop3_testing-0.4.0b1/src/hop3_testing/results/models.py +149 -0
  28. hop3_testing-0.4.0b1/src/hop3_testing/results/reporters.py +217 -0
  29. hop3_testing-0.4.0b1/src/hop3_testing/results/store.py +215 -0
  30. hop3_testing-0.4.0b1/src/hop3_testing/runners/__init__.py +28 -0
  31. hop3_testing-0.4.0b1/src/hop3_testing/runners/base.py +100 -0
  32. hop3_testing-0.4.0b1/src/hop3_testing/runners/demo.py +388 -0
  33. hop3_testing-0.4.0b1/src/hop3_testing/runners/deployment.py +312 -0
  34. hop3_testing-0.4.0b1/src/hop3_testing/runners/tutorial.py +270 -0
  35. hop3_testing-0.4.0b1/src/hop3_testing/runners/validations.py +332 -0
  36. hop3_testing-0.4.0b1/src/hop3_testing/selector/__init__.py +21 -0
  37. hop3_testing-0.4.0b1/src/hop3_testing/selector/modes.py +118 -0
  38. hop3_testing-0.4.0b1/src/hop3_testing/selector/selector.py +172 -0
  39. hop3_testing-0.4.0b1/src/hop3_testing/targets/__init__.py +61 -0
  40. hop3_testing-0.4.0b1/src/hop3_testing/targets/base.py +426 -0
  41. hop3_testing-0.4.0b1/src/hop3_testing/targets/config.py +122 -0
  42. hop3_testing-0.4.0b1/src/hop3_testing/targets/constants.py +43 -0
  43. hop3_testing-0.4.0b1/src/hop3_testing/targets/docker.py +670 -0
  44. hop3_testing-0.4.0b1/src/hop3_testing/targets/helpers.py +962 -0
  45. hop3_testing-0.4.0b1/src/hop3_testing/targets/remote.py +461 -0
  46. hop3_testing-0.4.0b1/src/hop3_testing/util/__init__.py +21 -0
  47. hop3_testing-0.4.0b1/src/hop3_testing/util/console.py +470 -0
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.3
2
+ Name: hop3-testing
3
+ Version: 0.4.0b1
4
+ Summary: Testing utilities for Hop3
5
+ Author: Stefane Fermigier
6
+ Author-email: Stefane Fermigier <sf@abilian.com>
7
+ Requires-Dist: hop3-cli
8
+ Requires-Dist: pytest>=8.0.0
9
+ Requires-Dist: docker>=7.0.0
10
+ Requires-Dist: tomli>=2.0.0 ; python_full_version < '3.11'
11
+ Requires-Dist: devtools>=0.12.2
12
+ Requires-Dist: python-dotenv>=1.0.1
13
+ Requires-Dist: httpcore>=1.0.6
14
+ Requires-Dist: httpx>=0.27.2
15
+ Requires-Dist: paramiko>=2.11.0,<3.0.0
16
+ Requires-Dist: click>=8.0.0
17
+ Requires-Dist: sqlalchemy>=2.0.0
18
+ Requires-Python: >=3.10, <4
19
+ Description-Content-Type: text/markdown
20
+
21
+ # hop3-testing
22
+
23
+ Testing framework for Hop3 deployment validation.
24
+
25
+ ## Overview
26
+
27
+ 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.
28
+
29
+ ## Features
30
+
31
+ - **Multiple targets** - Test against Docker containers or remote SSH servers
32
+ - **App catalog** - Pre-built test applications for various languages
33
+ - **Deployment sessions** - Automated deploy/verify/cleanup workflow
34
+ - **pytest fixtures** - Integration with pytest for E2E testing
35
+ - **Category filtering** - Run tests by language or framework
36
+
37
+ ## Installation
38
+
39
+ ### For development
40
+
41
+ ```bash
42
+ # From workspace root
43
+ cd packages/hop3-testing
44
+ uv pip install -e ".[dev]"
45
+ ```
46
+
47
+ ## Quick Start
48
+
49
+ ```bash
50
+ # Test all apps on Docker
51
+ hop3-test --target docker
52
+
53
+ # Test specific app
54
+ hop3-test --target docker 010-flask-pip-wsgi
55
+
56
+ # Test against remote server
57
+ hop3-test --target remote --host server.example.com
58
+
59
+ # Test specific category
60
+ hop3-test --target docker --category python-simple
61
+
62
+ # List available apps
63
+ hop3-test --list-apps
64
+ ```
65
+
66
+ ## Architecture
67
+
68
+ ```
69
+ hop3-testing/
70
+ ├── src/hop3_testing/
71
+ │ ├── main.py # CLI entry point
72
+ │ ├── base.py # Base test fixtures
73
+ │ ├── common.py # Shared utilities
74
+ │ ├── apps/
75
+ │ │ ├── catalog.py # App catalog management
76
+ │ │ └── deployment.py # Deployment session handling
77
+ │ ├── targets/
78
+ │ │ ├── base.py # Abstract target interface
79
+ │ │ ├── docker.py # Docker container target
80
+ │ │ └── remote.py # Remote SSH target
81
+ │ └── util/
82
+ │ ├── console.py # Output formatting
83
+ │ └── backports.py # Python compatibility
84
+ └── tests/
85
+ ```
86
+
87
+ ## Test Targets
88
+
89
+ ### Docker Target
90
+
91
+ Runs tests in isolated Docker containers:
92
+
93
+ ```bash
94
+ hop3-test --target docker --image ubuntu:24.04
95
+ ```
96
+
97
+ ### Remote Target
98
+
99
+ Runs tests against a remote Hop3 server:
100
+
101
+ ```bash
102
+ hop3-test --target remote --host server.example.com --ssh-key ~/.ssh/id_rsa
103
+ ```
104
+
105
+ ## App Categories
106
+
107
+ Test applications are organized by category:
108
+
109
+ | Category | Languages/Frameworks |
110
+ |----------|---------------------|
111
+ | `python-simple` | Flask, FastAPI, Django |
112
+ | `python-complex` | Multi-process, workers |
113
+ | `nodejs` | Express, Fastify |
114
+ | `ruby` | Sinatra, Rails |
115
+ | `go` | Fiber, Gin |
116
+ | `rust` | Actix-web, Axum |
117
+ | `static` | HTML, Hugo, Jekyll |
118
+
119
+ ## Using with pytest
120
+
121
+ ```python
122
+ # conftest.py
123
+ from hop3_testing import DeploymentTarget, AppCatalog
124
+
125
+ @pytest.fixture(scope="session")
126
+ def deployment_target():
127
+ """Provide a deployment target for tests."""
128
+ return DockerTarget()
129
+
130
+ @pytest.fixture
131
+ def app_catalog():
132
+ """Provide the test app catalog."""
133
+ return AppCatalog()
134
+
135
+ # test_deployment.py
136
+ def test_flask_app(deployment_target, app_catalog):
137
+ """Test Flask application deployment."""
138
+ app = app_catalog.get("010-flask-pip-wsgi")
139
+
140
+ with DeploymentSession(deployment_target, app) as session:
141
+ session.deploy()
142
+ assert session.verify_running()
143
+ assert session.verify_http_response()
144
+ ```
145
+
146
+ ## Development
147
+
148
+ ### Running tests
149
+
150
+ ```bash
151
+ # From package directory
152
+ uv run pytest tests/ -v
153
+
154
+ # With coverage
155
+ uv run pytest tests/ --cov=hop3_testing
156
+ ```
157
+
158
+ ### Code quality
159
+
160
+ ```bash
161
+ uv run ruff check src/
162
+ uv run ruff format src/
163
+ ```
164
+
165
+ ## Documentation
166
+
167
+ - **Testing Strategy**: [Testing guide](../../docs/src/dev/testing-strategy.md)
168
+ - **System Architecture**: [Architecture overview](../../docs/src/dev/architecture.md)
169
+ - **Package Internals**: [Deep-dive documentation](./docs/internals.md)
170
+
171
+ ## Related Packages
172
+
173
+ - [hop3-server](../hop3-server/) - The server being tested
174
+ - [hop3-cli](../hop3-cli/) - CLI used for deployments in tests
175
+
176
+ ## License
177
+
178
+ Apache-2.0 - Copyright (c) 2024-2025, Abilian SAS
@@ -0,0 +1,158 @@
1
+ # hop3-testing
2
+
3
+ Testing framework for Hop3 deployment validation.
4
+
5
+ ## Overview
6
+
7
+ 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.
8
+
9
+ ## Features
10
+
11
+ - **Multiple targets** - Test against Docker containers or remote SSH servers
12
+ - **App catalog** - Pre-built test applications for various languages
13
+ - **Deployment sessions** - Automated deploy/verify/cleanup workflow
14
+ - **pytest fixtures** - Integration with pytest for E2E testing
15
+ - **Category filtering** - Run tests by language or framework
16
+
17
+ ## Installation
18
+
19
+ ### For development
20
+
21
+ ```bash
22
+ # From workspace root
23
+ cd packages/hop3-testing
24
+ uv pip install -e ".[dev]"
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ # Test all apps on Docker
31
+ hop3-test --target docker
32
+
33
+ # Test specific app
34
+ hop3-test --target docker 010-flask-pip-wsgi
35
+
36
+ # Test against remote server
37
+ hop3-test --target remote --host server.example.com
38
+
39
+ # Test specific category
40
+ hop3-test --target docker --category python-simple
41
+
42
+ # List available apps
43
+ hop3-test --list-apps
44
+ ```
45
+
46
+ ## Architecture
47
+
48
+ ```
49
+ hop3-testing/
50
+ ├── src/hop3_testing/
51
+ │ ├── main.py # CLI entry point
52
+ │ ├── base.py # Base test fixtures
53
+ │ ├── common.py # Shared utilities
54
+ │ ├── apps/
55
+ │ │ ├── catalog.py # App catalog management
56
+ │ │ └── deployment.py # Deployment session handling
57
+ │ ├── targets/
58
+ │ │ ├── base.py # Abstract target interface
59
+ │ │ ├── docker.py # Docker container target
60
+ │ │ └── remote.py # Remote SSH target
61
+ │ └── util/
62
+ │ ├── console.py # Output formatting
63
+ │ └── backports.py # Python compatibility
64
+ └── tests/
65
+ ```
66
+
67
+ ## Test Targets
68
+
69
+ ### Docker Target
70
+
71
+ Runs tests in isolated Docker containers:
72
+
73
+ ```bash
74
+ hop3-test --target docker --image ubuntu:24.04
75
+ ```
76
+
77
+ ### Remote Target
78
+
79
+ Runs tests against a remote Hop3 server:
80
+
81
+ ```bash
82
+ hop3-test --target remote --host server.example.com --ssh-key ~/.ssh/id_rsa
83
+ ```
84
+
85
+ ## App Categories
86
+
87
+ Test applications are organized by category:
88
+
89
+ | Category | Languages/Frameworks |
90
+ |----------|---------------------|
91
+ | `python-simple` | Flask, FastAPI, Django |
92
+ | `python-complex` | Multi-process, workers |
93
+ | `nodejs` | Express, Fastify |
94
+ | `ruby` | Sinatra, Rails |
95
+ | `go` | Fiber, Gin |
96
+ | `rust` | Actix-web, Axum |
97
+ | `static` | HTML, Hugo, Jekyll |
98
+
99
+ ## Using with pytest
100
+
101
+ ```python
102
+ # conftest.py
103
+ from hop3_testing import DeploymentTarget, AppCatalog
104
+
105
+ @pytest.fixture(scope="session")
106
+ def deployment_target():
107
+ """Provide a deployment target for tests."""
108
+ return DockerTarget()
109
+
110
+ @pytest.fixture
111
+ def app_catalog():
112
+ """Provide the test app catalog."""
113
+ return AppCatalog()
114
+
115
+ # test_deployment.py
116
+ def test_flask_app(deployment_target, app_catalog):
117
+ """Test Flask application deployment."""
118
+ app = app_catalog.get("010-flask-pip-wsgi")
119
+
120
+ with DeploymentSession(deployment_target, app) as session:
121
+ session.deploy()
122
+ assert session.verify_running()
123
+ assert session.verify_http_response()
124
+ ```
125
+
126
+ ## Development
127
+
128
+ ### Running tests
129
+
130
+ ```bash
131
+ # From package directory
132
+ uv run pytest tests/ -v
133
+
134
+ # With coverage
135
+ uv run pytest tests/ --cov=hop3_testing
136
+ ```
137
+
138
+ ### Code quality
139
+
140
+ ```bash
141
+ uv run ruff check src/
142
+ uv run ruff format src/
143
+ ```
144
+
145
+ ## Documentation
146
+
147
+ - **Testing Strategy**: [Testing guide](../../docs/src/dev/testing-strategy.md)
148
+ - **System Architecture**: [Architecture overview](../../docs/src/dev/architecture.md)
149
+ - **Package Internals**: [Deep-dive documentation](./docs/internals.md)
150
+
151
+ ## Related Packages
152
+
153
+ - [hop3-server](../hop3-server/) - The server being tested
154
+ - [hop3-cli](../hop3-cli/) - CLI used for deployments in tests
155
+
156
+ ## License
157
+
158
+ Apache-2.0 - Copyright (c) 2024-2025, Abilian SAS
@@ -0,0 +1,40 @@
1
+ [project]
2
+ name = "hop3-testing"
3
+ version = "0.4.0.beta1"
4
+ description = "Testing utilities for Hop3"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Stefane Fermigier", email = "sf@abilian.com" }
8
+ ]
9
+ requires-python = ">=3.10, <4"
10
+ dependencies = [
11
+ # Hop3 packages
12
+ "hop3-cli",
13
+ # Testing
14
+ "pytest>=8.0.0",
15
+ "docker>=7.0.0",
16
+ # TOML parsing (Python 3.10 compat)
17
+ "tomli>=2.0.0; python_version < '3.11'",
18
+ # Dev tools
19
+ "devtools>=0.12.2",
20
+ "python-dotenv>=1.0.1",
21
+ # Communication
22
+ "httpcore>=1.0.6",
23
+ "httpx>=0.27.2",
24
+ # Pin paramiko to 2.x for compatibility with sshtunnel (used in hop3-cli)
25
+ "paramiko>=2.11.0,<3.0.0",
26
+ # CLI
27
+ "click>=8.0.0",
28
+ # Result storage
29
+ "sqlalchemy>=2.0.0",
30
+ ]
31
+
32
+ [project.scripts]
33
+ # Main CLI entry point
34
+ # hop3-test = "hop3_testing.cli:main"
35
+ # Alias for transition period
36
+ hop3-test = "hop3_testing.cli:main"
37
+
38
+ [build-system]
39
+ requires = ["uv-build>=0.8.4,<0.9.0"]
40
+ build-backend = "uv_build"
@@ -0,0 +1,20 @@
1
+ # Copyright (c) 2023-2025, Abilian SAS
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Hop3 deployment testing framework."""
6
+
7
+ from __future__ import annotations
8
+
9
+ import warnings
10
+
11
+ # Suppress TripleDES deprecation warnings from paramiko
12
+ # This happens when paramiko imports the cipher at module load time
13
+ # We disable using it in connections via disabled_algorithms config
14
+ try:
15
+ from cryptography.utils import CryptographyDeprecationWarning
16
+
17
+ warnings.filterwarnings("ignore", category=CryptographyDeprecationWarning)
18
+ except ImportError:
19
+ # Fallback if CryptographyDeprecationWarning not available
20
+ warnings.filterwarnings("ignore", message=".*TripleDES.*")
@@ -0,0 +1,23 @@
1
+ # Copyright (c) 2023-2025, Abilian SAS
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Test application utilities."""
6
+
7
+ from __future__ import annotations
8
+
9
+ from .catalog import AppSource
10
+ from .debug import DeploymentDebugger
11
+ from .deployment import DeploymentSession
12
+ from .preparation import AppPreparation
13
+ from .verification import AppVerifier, CheckScriptRunner, HttpVerifier
14
+
15
+ __all__ = [
16
+ "AppPreparation",
17
+ "AppSource",
18
+ "AppVerifier",
19
+ "CheckScriptRunner",
20
+ "DeploymentDebugger",
21
+ "DeploymentSession",
22
+ "HttpVerifier",
23
+ ]
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2023-2025, Abilian SAS
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Test application data class for deployment sessions."""
6
+
7
+ from __future__ import annotations
8
+
9
+ from dataclasses import dataclass
10
+ from pathlib import Path
11
+
12
+
13
+ @dataclass
14
+ class AppSource:
15
+ """Represents a test application for deployment.
16
+
17
+ This is a simple data class used by DeploymentSession to track
18
+ app metadata during deployment and testing.
19
+ """
20
+
21
+ name: str
22
+ path: Path
23
+ category: str = ""
24
+ description: str = ""
25
+
26
+ @property
27
+ def has_check_script(self) -> bool:
28
+ """Check if app has a check.py script."""
29
+ return (self.path / "check.py").exists()
30
+
31
+ @property
32
+ def has_procfile(self) -> bool:
33
+ """Check if app has a Procfile."""
34
+ return (self.path / "Procfile").exists()