hop3-testing 0.4.0__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 (64) hide show
  1. hop3_testing-0.4.0/PKG-INFO +183 -0
  2. hop3_testing-0.4.0/README.md +155 -0
  3. hop3_testing-0.4.0/pyproject.toml +58 -0
  4. hop3_testing-0.4.0/src/hop3_testing/__init__.py +20 -0
  5. hop3_testing-0.4.0/src/hop3_testing/apps/__init__.py +23 -0
  6. hop3_testing-0.4.0/src/hop3_testing/apps/catalog.py +41 -0
  7. hop3_testing-0.4.0/src/hop3_testing/apps/debug.py +458 -0
  8. hop3_testing-0.4.0/src/hop3_testing/apps/deployment.py +569 -0
  9. hop3_testing-0.4.0/src/hop3_testing/apps/preparation.py +141 -0
  10. hop3_testing-0.4.0/src/hop3_testing/apps/verification.py +363 -0
  11. hop3_testing-0.4.0/src/hop3_testing/catalog/__init__.py +47 -0
  12. hop3_testing-0.4.0/src/hop3_testing/catalog/loader.py +607 -0
  13. hop3_testing-0.4.0/src/hop3_testing/catalog/models.py +310 -0
  14. hop3_testing-0.4.0/src/hop3_testing/catalog/scanner.py +386 -0
  15. hop3_testing-0.4.0/src/hop3_testing/cli/__init__.py +56 -0
  16. hop3_testing-0.4.0/src/hop3_testing/cli/commands/__init__.py +53 -0
  17. hop3_testing-0.4.0/src/hop3_testing/cli/commands/build.py +139 -0
  18. hop3_testing-0.4.0/src/hop3_testing/cli/commands/catalog.py +96 -0
  19. hop3_testing-0.4.0/src/hop3_testing/cli/commands/hetzner.py +209 -0
  20. hop3_testing-0.4.0/src/hop3_testing/cli/commands/modes.py +95 -0
  21. hop3_testing-0.4.0/src/hop3_testing/cli/commands/run.py +138 -0
  22. hop3_testing-0.4.0/src/hop3_testing/cli/commands/test.py +493 -0
  23. hop3_testing-0.4.0/src/hop3_testing/cli/helpers.py +93 -0
  24. hop3_testing-0.4.0/src/hop3_testing/cli/logging.py +125 -0
  25. hop3_testing-0.4.0/src/hop3_testing/cli/reports.py +525 -0
  26. hop3_testing-0.4.0/src/hop3_testing/cli/runners.py +329 -0
  27. hop3_testing-0.4.0/src/hop3_testing/diagnostics.py +540 -0
  28. hop3_testing-0.4.0/src/hop3_testing/exceptions.py +27 -0
  29. hop3_testing-0.4.0/src/hop3_testing/results/__init__.py +25 -0
  30. hop3_testing-0.4.0/src/hop3_testing/results/models.py +152 -0
  31. hop3_testing-0.4.0/src/hop3_testing/results/reporters.py +217 -0
  32. hop3_testing-0.4.0/src/hop3_testing/results/store.py +215 -0
  33. hop3_testing-0.4.0/src/hop3_testing/runners/__init__.py +28 -0
  34. hop3_testing-0.4.0/src/hop3_testing/runners/base.py +100 -0
  35. hop3_testing-0.4.0/src/hop3_testing/runners/demo.py +396 -0
  36. hop3_testing-0.4.0/src/hop3_testing/runners/deployment.py +315 -0
  37. hop3_testing-0.4.0/src/hop3_testing/runners/tutorial.py +270 -0
  38. hop3_testing-0.4.0/src/hop3_testing/runners/validations.py +332 -0
  39. hop3_testing-0.4.0/src/hop3_testing/selector/__init__.py +21 -0
  40. hop3_testing-0.4.0/src/hop3_testing/selector/modes.py +118 -0
  41. hop3_testing-0.4.0/src/hop3_testing/selector/selector.py +172 -0
  42. hop3_testing-0.4.0/src/hop3_testing/system_tests/__init__.py +60 -0
  43. hop3_testing-0.4.0/src/hop3_testing/system_tests/config.py +259 -0
  44. hop3_testing-0.4.0/src/hop3_testing/system_tests/deployment.py +627 -0
  45. hop3_testing-0.4.0/src/hop3_testing/system_tests/diagnostics.py +351 -0
  46. hop3_testing-0.4.0/src/hop3_testing/system_tests/hetzner.py +437 -0
  47. hop3_testing-0.4.0/src/hop3_testing/system_tests/hetzner_cli.py +574 -0
  48. hop3_testing-0.4.0/src/hop3_testing/system_tests/multi_distro.py +296 -0
  49. hop3_testing-0.4.0/src/hop3_testing/system_tests/orchestrator.py +939 -0
  50. hop3_testing-0.4.0/src/hop3_testing/system_tests/runner.py +667 -0
  51. hop3_testing-0.4.0/src/hop3_testing/system_tests/server_runner.py +387 -0
  52. hop3_testing-0.4.0/src/hop3_testing/system_tests/ssh.py +377 -0
  53. hop3_testing-0.4.0/src/hop3_testing/targets/__init__.py +61 -0
  54. hop3_testing-0.4.0/src/hop3_testing/targets/base.py +442 -0
  55. hop3_testing-0.4.0/src/hop3_testing/targets/config.py +124 -0
  56. hop3_testing-0.4.0/src/hop3_testing/targets/constants.py +78 -0
  57. hop3_testing-0.4.0/src/hop3_testing/targets/docker.py +678 -0
  58. hop3_testing-0.4.0/src/hop3_testing/targets/helpers.py +962 -0
  59. hop3_testing-0.4.0/src/hop3_testing/targets/remote.py +459 -0
  60. hop3_testing-0.4.0/src/hop3_testing/util/__init__.py +26 -0
  61. hop3_testing-0.4.0/src/hop3_testing/util/console.py +470 -0
  62. hop3_testing-0.4.0/src/hop3_testing/util/project.py +86 -0
  63. hop3_testing-0.4.0/src/hop3_testing/util/streaming.py +149 -0
  64. hop3_testing-0.4.0/src/hop3_testing/util/subprocess.py +30 -0
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: hop3-testing
3
+ Version: 0.4.0
4
+ Summary: Testing utilities for Hop3
5
+ Author: Stefane Fermigier
6
+ Author-email: Stefane Fermigier <sf@abilian.com>
7
+ License-Expression: Apache-2.0
8
+ Requires-Dist: hop3-cli
9
+ Requires-Dist: hop3-installer
10
+ Requires-Dist: pytest>=8.0.0
11
+ Requires-Dist: docker>=7.0.0
12
+ Requires-Dist: tomli>=2.0.0 ; python_full_version < '3.11'
13
+ Requires-Dist: devtools>=0.12.2
14
+ Requires-Dist: python-dotenv>=1.0.1
15
+ Requires-Dist: httpcore>=1.0.6
16
+ Requires-Dist: httpx>=0.27.2
17
+ Requires-Dist: paramiko>=2.11.0,<3.0.0
18
+ Requires-Dist: click>=8.0.0
19
+ Requires-Dist: sqlalchemy>=2.0.0
20
+ Requires-Dist: pyjwt>=2.8.0
21
+ Requires-Dist: hcloud>=2.0
22
+ Requires-Dist: jinja2>=3.0
23
+ Requires-Dist: rich>=13.0
24
+ Requires-Dist: attrs>=23.0
25
+ Requires-Dist: termcolor>=2.0
26
+ Requires-Python: >=3.10, <4
27
+ Description-Content-Type: text/markdown
28
+
29
+ # hop3-testing
30
+
31
+ Testing framework for Hop3 deployment validation.
32
+
33
+ ## Overview
34
+
35
+ 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.
36
+
37
+ ## Features
38
+
39
+ - **Multiple targets**: Test against Docker containers or remote SSH servers
40
+ - **App catalog**: Pre-built test applications for various languages
41
+ - **Deployment sessions**: Automated deploy/verify/cleanup workflow
42
+ - **pytest fixtures**: Integration with pytest for E2E testing
43
+ - **Category filtering**: Run tests by language or framework
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install hop3-testing
49
+ ```
50
+
51
+ ## Quick Start
52
+
53
+ ```bash
54
+ # List available tests
55
+ hop3-test list
56
+
57
+ # Run system tests on Docker
58
+ hop3-test system --docker
59
+
60
+ # Test specific apps
61
+ hop3-test apps 010-flask-pip-wsgi
62
+
63
+ # Test against remote server
64
+ hop3-test apps --host server.example.com
65
+
66
+ # Run CI tests
67
+ hop3-test ci
68
+ ```
69
+
70
+ ## Commands
71
+
72
+ | Command | Description |
73
+ |---------|-------------|
74
+ | `hop3-test system` | Deploy Hop3 and run system tests |
75
+ | `hop3-test apps` | Test apps against pre-deployed Hop3 |
76
+ | `hop3-test list` | List available tests |
77
+ | `hop3-test show <name>` | Show test details |
78
+ | `hop3-test ci` | Run CI tests (fast+medium, P0) |
79
+ | `hop3-test dev` | Run developer tests (fast, P0 only) |
80
+ | `hop3-test hetzner` | Run E2E tests on Hetzner Cloud |
81
+ | `hop3-test multi-distro` | Test across multiple Linux distributions |
82
+
83
+ ### Common Options
84
+
85
+ | Option | Description |
86
+ |--------|-------------|
87
+ | `-v, --verbose` | Verbose output |
88
+ | `--fail-fast` | Stop on first failure |
89
+ | `--keep` | Keep apps deployed after testing |
90
+ | `--docker` | Use Docker target |
91
+ | `--host HOST` | Remote server hostname |
92
+
93
+ ## Architecture
94
+
95
+ ```
96
+ hop3-testing/
97
+ ├── src/hop3_testing/
98
+ │ ├── cli/ # CLI commands
99
+ │ │ └── commands/ # Click command implementations
100
+ │ ├── catalog/ # Test discovery
101
+ │ │ ├── scanner.py # Discovers test.toml files
102
+ │ │ └── models.py # TestDefinition, Category
103
+ │ ├── apps/
104
+ │ │ ├── catalog.py # AppSource dataclass
105
+ │ │ └── deployment.py # DeploymentSession
106
+ │ ├── targets/
107
+ │ │ ├── base.py # DeploymentTarget ABC
108
+ │ │ ├── docker.py # DockerTarget
109
+ │ │ └── remote.py # RemoteTarget
110
+ │ └── results/ # Result storage and reporting
111
+ └── tests/
112
+ ```
113
+
114
+ ## Test Categories
115
+
116
+ | Category | Languages/Frameworks |
117
+ |----------|---------------------|
118
+ | `python` | Flask, FastAPI, Django |
119
+ | `nodejs` | Express, Fastify |
120
+ | `ruby` | Sinatra, Rails |
121
+ | `go` | Fiber, Gin |
122
+ | `rust` | Actix-web, Axum |
123
+ | `static` | HTML, Hugo, Jekyll |
124
+
125
+ ## Hetzner Cloud Testing
126
+
127
+ Run full E2E tests on real Hetzner Cloud servers. Requires `HETZNER_API_TOKEN` environment variable.
128
+
129
+ ```bash
130
+ # List available images
131
+ hop3-test multi-distro --list-images
132
+
133
+ # Run tests on a single distribution
134
+ hop3-test hetzner --image ubuntu-24.04 --suites test-apps
135
+
136
+ # Run tests across multiple distributions
137
+ hop3-test multi-distro --images ubuntu-24.04 debian-13 fedora-42
138
+
139
+ # Use local code instead of git
140
+ hop3-test hetzner --use-local-repo
141
+
142
+ # Skip phases for debugging
143
+ hop3-test hetzner --skip-reset # Keep existing server state
144
+ hop3-test hetzner --skip-deploy # Use existing Hop3 installation
145
+ hop3-test hetzner --skip-tests # Only reset and deploy
146
+ ```
147
+
148
+ ### Hetzner Options
149
+
150
+ | Option | Description |
151
+ |--------|-------------|
152
+ | `--server-id ID` | Use specific Hetzner server |
153
+ | `--image IMAGE` | OS image (e.g., ubuntu-24.04) |
154
+ | `--branch BRANCH` | Git branch to test (default: devel) |
155
+ | `--use-local-repo` | Deploy from local code |
156
+ | `--skip-reset` | Skip server reset |
157
+ | `--skip-deploy` | Skip Hop3 deployment |
158
+ | `--suites SUITE` | Test suites to run |
159
+ | `--continue-on-failure` | Don't stop on first failure (multi-distro) |
160
+
161
+ ## Development
162
+
163
+ ```bash
164
+ # Run tests
165
+ uv run pytest tests/ -v
166
+
167
+ # Lint and format
168
+ uv run ruff check src/
169
+ uv run ruff format src/
170
+ ```
171
+
172
+ ## Documentation
173
+
174
+ - [Testing Strategy](../../docs/src/dev/testing-strategy.md)
175
+
176
+ ## Related Packages
177
+
178
+ - [hop3-server](../hop3-server/) - The server being tested
179
+ - [hop3-cli](../hop3-cli/) - CLI used for deployments in tests
180
+
181
+ ## License
182
+
183
+ Apache-2.0 - Copyright (c) 2024-2026, Abilian SAS
@@ -0,0 +1,155 @@
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
+ ```bash
20
+ pip install hop3-testing
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # List available tests
27
+ hop3-test list
28
+
29
+ # Run system tests on Docker
30
+ hop3-test system --docker
31
+
32
+ # Test specific apps
33
+ hop3-test apps 010-flask-pip-wsgi
34
+
35
+ # Test against remote server
36
+ hop3-test apps --host server.example.com
37
+
38
+ # Run CI tests
39
+ hop3-test ci
40
+ ```
41
+
42
+ ## Commands
43
+
44
+ | Command | Description |
45
+ |---------|-------------|
46
+ | `hop3-test system` | Deploy Hop3 and run system tests |
47
+ | `hop3-test apps` | Test apps against pre-deployed Hop3 |
48
+ | `hop3-test list` | List available tests |
49
+ | `hop3-test show <name>` | Show test details |
50
+ | `hop3-test ci` | Run CI tests (fast+medium, P0) |
51
+ | `hop3-test dev` | Run developer tests (fast, P0 only) |
52
+ | `hop3-test hetzner` | Run E2E tests on Hetzner Cloud |
53
+ | `hop3-test multi-distro` | Test across multiple Linux distributions |
54
+
55
+ ### Common Options
56
+
57
+ | Option | Description |
58
+ |--------|-------------|
59
+ | `-v, --verbose` | Verbose output |
60
+ | `--fail-fast` | Stop on first failure |
61
+ | `--keep` | Keep apps deployed after testing |
62
+ | `--docker` | Use Docker target |
63
+ | `--host HOST` | Remote server hostname |
64
+
65
+ ## Architecture
66
+
67
+ ```
68
+ hop3-testing/
69
+ ├── src/hop3_testing/
70
+ │ ├── cli/ # CLI commands
71
+ │ │ └── commands/ # Click command implementations
72
+ │ ├── catalog/ # Test discovery
73
+ │ │ ├── scanner.py # Discovers test.toml files
74
+ │ │ └── models.py # TestDefinition, Category
75
+ │ ├── apps/
76
+ │ │ ├── catalog.py # AppSource dataclass
77
+ │ │ └── deployment.py # DeploymentSession
78
+ │ ├── targets/
79
+ │ │ ├── base.py # DeploymentTarget ABC
80
+ │ │ ├── docker.py # DockerTarget
81
+ │ │ └── remote.py # RemoteTarget
82
+ │ └── results/ # Result storage and reporting
83
+ └── tests/
84
+ ```
85
+
86
+ ## Test Categories
87
+
88
+ | Category | Languages/Frameworks |
89
+ |----------|---------------------|
90
+ | `python` | Flask, FastAPI, Django |
91
+ | `nodejs` | Express, Fastify |
92
+ | `ruby` | Sinatra, Rails |
93
+ | `go` | Fiber, Gin |
94
+ | `rust` | Actix-web, Axum |
95
+ | `static` | HTML, Hugo, Jekyll |
96
+
97
+ ## Hetzner Cloud Testing
98
+
99
+ Run full E2E tests on real Hetzner Cloud servers. Requires `HETZNER_API_TOKEN` environment variable.
100
+
101
+ ```bash
102
+ # List available images
103
+ hop3-test multi-distro --list-images
104
+
105
+ # Run tests on a single distribution
106
+ hop3-test hetzner --image ubuntu-24.04 --suites test-apps
107
+
108
+ # Run tests across multiple distributions
109
+ hop3-test multi-distro --images ubuntu-24.04 debian-13 fedora-42
110
+
111
+ # Use local code instead of git
112
+ hop3-test hetzner --use-local-repo
113
+
114
+ # Skip phases for debugging
115
+ hop3-test hetzner --skip-reset # Keep existing server state
116
+ hop3-test hetzner --skip-deploy # Use existing Hop3 installation
117
+ hop3-test hetzner --skip-tests # Only reset and deploy
118
+ ```
119
+
120
+ ### Hetzner Options
121
+
122
+ | Option | Description |
123
+ |--------|-------------|
124
+ | `--server-id ID` | Use specific Hetzner server |
125
+ | `--image IMAGE` | OS image (e.g., ubuntu-24.04) |
126
+ | `--branch BRANCH` | Git branch to test (default: devel) |
127
+ | `--use-local-repo` | Deploy from local code |
128
+ | `--skip-reset` | Skip server reset |
129
+ | `--skip-deploy` | Skip Hop3 deployment |
130
+ | `--suites SUITE` | Test suites to run |
131
+ | `--continue-on-failure` | Don't stop on first failure (multi-distro) |
132
+
133
+ ## Development
134
+
135
+ ```bash
136
+ # Run tests
137
+ uv run pytest tests/ -v
138
+
139
+ # Lint and format
140
+ uv run ruff check src/
141
+ uv run ruff format src/
142
+ ```
143
+
144
+ ## Documentation
145
+
146
+ - [Testing Strategy](../../docs/src/dev/testing-strategy.md)
147
+
148
+ ## Related Packages
149
+
150
+ - [hop3-server](../hop3-server/) - The server being tested
151
+ - [hop3-cli](../hop3-cli/) - CLI used for deployments in tests
152
+
153
+ ## License
154
+
155
+ Apache-2.0 - Copyright (c) 2024-2026, Abilian SAS
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "hop3-testing"
3
+ version = "0.4.0"
4
+ description = "Testing utilities for Hop3"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ authors = [
8
+ { name = "Stefane Fermigier", email = "sf@abilian.com" }
9
+ ]
10
+ requires-python = ">=3.10, <4"
11
+ dependencies = [
12
+ # Hop3 packages
13
+ "hop3-cli",
14
+ "hop3-installer",
15
+ # Testing
16
+ "pytest>=8.0.0",
17
+ "docker>=7.0.0",
18
+ # TOML parsing (Python 3.10 compat)
19
+ "tomli>=2.0.0; python_version < '3.11'",
20
+ # Dev tools
21
+ "devtools>=0.12.2",
22
+ "python-dotenv>=1.0.1",
23
+ # Communication
24
+ "httpcore>=1.0.6",
25
+ "httpx>=0.27.2",
26
+ # Pin paramiko to 2.x for compatibility with sshtunnel (used in hop3-cli)
27
+ "paramiko>=2.11.0,<3.0.0",
28
+ # CLI
29
+ "click>=8.0.0",
30
+ # Result storage
31
+ "sqlalchemy>=2.0.0",
32
+ # JWT token generation for E2E tests
33
+ "PyJWT>=2.8.0",
34
+ # Hetzner system tests
35
+ "hcloud>=2.0",
36
+ "jinja2>=3.0",
37
+ "rich>=13.0",
38
+ "attrs>=23.0",
39
+ "termcolor>=2.0",
40
+ ]
41
+
42
+ [project.scripts]
43
+ hop3-test = "hop3_testing.cli:main"
44
+
45
+ [build-system]
46
+ requires = ["uv-build>=0.8.4,<0.9.0"]
47
+ build-backend = "uv_build"
48
+
49
+ #
50
+ # Tools
51
+ #
52
+
53
+ # Keep!
54
+ [tool.pyrefly]
55
+ project-includes = [
56
+ "**/*.py*",
57
+ "**/*.ipynb",
58
+ ]
@@ -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,41 @@
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
+
35
+ Checks for Procfile in:
36
+ 1. Root directory (standard location)
37
+ 2. hop3/ subdirectory (alternate config path)
38
+ """
39
+ return (self.path / "Procfile").exists() or (
40
+ self.path / "hop3" / "Procfile"
41
+ ).exists()