GH : 443 | Invalidating attributes after the given startTime and end… #108
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CORE API Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'opengin/core-api/**' | |
| - 'opengin/core-api/docker/Dockerfile' | |
| - 'opengin/core-api/docker/Dockerfile.choreo' | |
| - 'docker-compose.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'opengin/core-api/**' | |
| - 'opengin/core-api/docker/Dockerfile' | |
| - 'opengin/core-api/docker/Dockerfile.choreo' | |
| - 'docker-compose.yml' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and test CORE service | |
| run: | | |
| # Build CORE service | |
| docker compose build core | |
| # Start required dependencies | |
| docker compose up -d mongodb neo4j postgres | |
| # Wait for dependencies to be healthy | |
| echo "Waiting for MongoDB, Neo4j and Postgres to be healthy..." | |
| docker compose ps | |
| # Wait for dependencies to be ready (with timeout) | |
| timeout 300 bash -c 'until docker compose ps | grep -q "healthy"; do echo "Waiting for services to be healthy..."; sleep 5; done' | |
| # Start CORE service and capture logs | |
| echo "Starting CORE service and running tests..." | |
| docker compose up core > core.log 2>&1 & | |
| CORE_PID=$! | |
| # Wait for the service to start and tests to begin | |
| echo "Waiting for CORE service to start..." | |
| timeout 120 bash -c 'until grep -q "Running tests with environment" core.log; do echo "Waiting for tests to start..."; sleep 2; done' | |
| # Wait for tests to complete (look for test completion indicators) | |
| echo "Waiting for tests to complete..." | |
| timeout 300 bash -c ' | |
| while true; do | |
| if grep -q "❌ Tests failed!" core.log; then | |
| echo "Tests failed detected in logs" | |
| break | |
| elif grep -q "✅ All tests passed!" core.log; then | |
| echo "Tests completed successfully" | |
| break | |
| elif grep -q "=== Starting CORE Service ===" core.log; then | |
| echo "Tests completed successfully, service starting" | |
| break | |
| elif grep -q "exit status 1" core.log; then | |
| echo "Test exit with error detected" | |
| break | |
| fi | |
| echo "Tests still running... checking logs" | |
| sleep 10 | |
| done | |
| ' | |
| # Kill the background process and get final logs | |
| kill $CORE_PID 2>/dev/null || true | |
| wait $CORE_PID 2>/dev/null || true | |
| # Show all logs | |
| echo "=== Full CORE Service Logs ===" | |
| cat core.log | |
| # Also show container logs for additional debugging | |
| echo "=== Container Logs ===" | |
| docker compose logs core || true | |
| # Check test results | |
| if grep -q "❌ Tests failed!" core.log; then | |
| echo "❌ CORE API tests failed!" | |
| docker compose down | |
| exit 1 | |
| elif grep -q "✅ All tests passed!" core.log || grep -q "=== Starting CORE Service ===" core.log; then | |
| echo "✅ CORE API tests passed!" | |
| else | |
| echo "❓ Could not determine test status from logs" | |
| echo "Checking if service started successfully..." | |
| if grep -q "Starting CORE service" core.log; then | |
| echo "✅ CORE API tests passed (service started successfully)!" | |
| else | |
| echo "❌ Test results unclear - failing build" | |
| docker compose down | |
| exit 1 | |
| fi | |
| fi | |
| # Cleanup | |
| docker compose down |