chore: Add test reports directory creation step in CI workflows
Some checks failed
Docker Build and Push / build-and-push (push) Failing after 36s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 1m11s
Integration Tests / integration-tests (push) Failing after 29s
LabFusion CI/CD Pipeline / api-docs (push) Successful in 1m42s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 11s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 19s
LabFusion CI/CD Pipeline / frontend (push) Failing after 1m50s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 20s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 21s
Service Adapters (Python FastAPI) / build (push) Has been skipped
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 20s

### Summary of Changes
- Introduced a step to create a `tests/reports` directory in both CI workflows for Service Adapters and the main CI configuration.
- This ensures that test reports have a designated location for output, improving organization and accessibility.

### Expected Results
- Enhanced structure for test report generation, facilitating easier access to test results and improving overall CI workflow clarity.
This commit is contained in:
GSRN
2025-09-15 21:03:17 +02:00
parent 22f806f6fa
commit 64d4e405c5
10 changed files with 589 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
"""
Tests for the main FastAPI application
"""
import pytest
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
class TestMainApp:
"""Test the main FastAPI application"""
def test_app_creation(self):
"""Test that the FastAPI app is created correctly"""
assert app is not None
assert app.title == "LabFusion Service Adapters"
assert app.version == "1.0.0"
def test_cors_middleware(self):
"""Test that CORS middleware is properly configured"""
# Test a simple request to verify CORS headers
response = client.get("/")
assert response.status_code == 200
# CORS headers should be present
assert "access-control-allow-origin" in response.headers
def test_routers_included(self):
"""Test that all routers are included"""
# Check that all expected routes are available
routes = [route.path for route in app.routes]
# General routes
assert "/" in routes
assert "/health" in routes
assert "/services" in routes
# Other service routes should be included
# (exact paths depend on router definitions)
def test_openapi_docs(self):
"""Test that OpenAPI documentation is available"""
response = client.get("/docs")
assert response.status_code == 200
response = client.get("/openapi.json")
assert response.status_code == 200
assert "openapi" in response.json()