diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8af749b..bd194ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,7 @@ jobs: - name: Run Docker Compose E2E tests run: | export PATH="$HOME/.local/bin:$PATH" - uv run pytest tests_e2e/test_docker_compose.py -sv + uv run pytest tests_e2e/test_docker_compose.py -sv --tb=short Tests-E2E-Kubernetes: runs-on: ubuntu-latest @@ -84,7 +84,7 @@ jobs: - name: Run Kubernetes E2E tests run: | export PATH="$HOME/.local/bin:$PATH" - uv run pytest tests_e2e/test_kubernetes.py -sv + uv run pytest tests_e2e/test_kubernetes.py -sv --tb=short Build: runs-on: ubuntu-latest diff --git a/tests_e2e/conftest.py b/tests_e2e/conftest.py index f0d9176..de4f76d 100644 --- a/tests_e2e/conftest.py +++ b/tests_e2e/conftest.py @@ -27,6 +27,7 @@ def generate_ssl_certificates(): pytest.skip(f"SSL certificate generation script not found: {script_path}") # Run from tests_e2e directory (Docker approach - WORKING) + print("\n[Setup] Generating SSL certificates and JWT keys...") result = subprocess.run( ["bash", str(script_path)], cwd=BASE_DIR, # NOT BASE_DIR.parent (K8s bug) @@ -35,8 +36,12 @@ def generate_ssl_certificates(): ) if result.returncode != 0: + print(f"[Setup] ERROR: Certificate generation failed!") + print(f"[Setup] stderr: {result.stderr}") pytest.fail(f"Failed to generate SSL certificates:\n{result.stderr}") + print("[Setup] ✓ SSL certificates and JWT keys generated successfully") + # Return paths for K8s tests to use yield { "host1_local": BASE_DIR / "static" / "host1.local.pem", diff --git a/tests_e2e/test_docker_compose.py b/tests_e2e/test_docker_compose.py index 2541aa9..247840d 100644 --- a/tests_e2e/test_docker_compose.py +++ b/tests_e2e/test_docker_compose.py @@ -49,24 +49,47 @@ class DockerComposeFixture: def up(self): """Start docker-compose services""" + compose_name = Path(self.compose_file).name + print(f"\n[Docker] Starting services from {compose_name}...") + cmd = ["docker", "compose", "-f", self.compose_file, "up", "-d"] if self.build: cmd.append("--build") - subprocess.run( + + result = subprocess.run( cmd, - check=True, - capture_output=True + capture_output=True, + text=True ) + + if result.returncode != 0: + print(f"[Docker] ERROR: Failed to start services!") + print(f"[Docker] stdout: {result.stdout}") + print(f"[Docker] stderr: {result.stderr}") + raise subprocess.CalledProcessError(result.returncode, cmd, result.stdout, result.stderr) + + print(f"[Docker] ✓ Services started, waiting {self.startup_wait}s for initialization...") time.sleep(self.startup_wait) + print(f"[Docker] ✓ Services ready") def down(self): """Stop and remove docker-compose services""" - subprocess.run( + compose_name = Path(self.compose_file).name + print(f"[Docker] Stopping services from {compose_name}...") + + result = subprocess.run( ["docker", "compose", "-f", self.compose_file, "down", "--remove-orphans"], - check=True, - capture_output=True + capture_output=True, + text=True ) + if result.returncode != 0: + print(f"[Docker] WARNING: Failed to stop services cleanly") + print(f"[Docker] stderr: {result.stderr}") + # Don't raise error on cleanup, just warn + else: + print(f"[Docker] ✓ Services stopped and cleaned up") + @pytest.fixture def docker_compose_basic_ssl() -> Generator[None, None, None]: