fix: Resolve test report generation issues in API Gateway
Some checks failed
Docker Build and Push / build-and-push (push) Failing after 34s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 1m12s
API Gateway (Java Spring Boot) / test (21) (push) Failing after 1m32s
API Gateway (Java Spring Boot) / test (17) (push) Failing after 1m48s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 1m52s
LabFusion CI/CD Pipeline / api-docs (push) Successful in 51s
LabFusion CI/CD Pipeline / frontend (push) Failing after 1m48s
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Integration Tests / integration-tests (push) Failing after 2m31s
Integration Tests / performance-tests (push) Has been skipped

## Problem Fixed
- Test report generation was failing with 'No test report files were found'
- Issue was caused by incorrect path and missing test files

## Changes Made

### 1. Fixed Test Report Path
- Changed path from 'services/api-gateway/target/surefire-reports/*.xml' to 'target/surefire-reports/*.xml'
- Path was incorrect due to working-directory being set to ./services/api-gateway

### 2. Added Test Report Debugging
- Added 'Check test reports' step to debug test report generation
- Shows directory contents and file existence

### 3. Made Test Report Generation Resilient
- Added 'continue-on-error: true' to prevent workflow failure
- Changed condition to 'always() && (success() || failure())'

### 4. Created Basic Test Structure
- Added src/test/java/com/labfusion/ directory
- Created LabFusionApiGatewayApplicationTests.java with basic tests
- Added src/test/resources/application.yml for test configuration
- Added H2 database dependency for testing

### 5. Test Configuration
- Uses H2 in-memory database for tests
- Random port assignment for test server
- Proper test profiles and logging configuration

## Expected Results
- Test reports will now generate correctly when tests exist
- Workflow won't fail if no test files are present
- Basic integration tests will run and generate reports
- Better debugging information for test report issues
This commit is contained in:
GSRN
2025-09-15 19:01:13 +02:00
parent 9ab95a3d42
commit 1f53b3ec39
4 changed files with 73 additions and 2 deletions

View File

@@ -55,6 +55,13 @@
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- H2 Database for Testing -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<!-- Redis -->
<dependency>