Skip to content

Merge pull request #354 from devstress/copilot/fix-failed-tests-and-u… #55

Merge pull request #354 from devstress/copilot/fix-failed-tests-and-u…

Merge pull request #354 from devstress/copilot/fix-failed-tests-and-u… #55

name: LearningCourse Integration Tests
on:
push:
paths:
- 'LearningCourse/**'
workflow_dispatch:
jobs:
learningcourse-integration-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: '3.9.6'
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Install .NET Aspire workload
run: |
echo "📦 Installing .NET Aspire workload..."
dotnet workload install aspire
echo "✅ Aspire workload installed successfully"
- name: Verify Docker environment
run: |
echo "=== Verifying Docker environment ==="
docker --version
docker compose version
docker info
docker ps -a
echo "Docker service status:"
sudo systemctl status docker --no-pager || true
echo "Starting Docker if not running..."
sudo systemctl start docker || true
sleep 5
docker ps
echo "=== Pulling required Docker images ==="
docker pull confluentinc/cp-kafka:latest || true
docker pull flink:2.1.0-java17 || true
docker pull temporalio/auto-setup:1.22.4 || true
docker pull postgres:latest || true
docker pull bitnami/redis:latest || true
docker pull prom/prometheus:latest || true
docker pull grafana/grafana:latest || true
echo "✅ Docker is ready"
- name: Configure system for Kafka performance
run: |
echo "=== Configuring system for optimal Kafka performance ==="
sudo sysctl -w vm.max_map_count=262144
sudo bash -c 'echo "* soft nofile 65536" >> /etc/security/limits.conf'
sudo bash -c 'echo "* hard nofile 65536" >> /etc/security/limits.conf'
echo "Current vm.max_map_count: $(sysctl vm.max_map_count)"
echo "Current ulimit -n: $(ulimit -n)"
echo "Available memory: $(free -h)"
echo "CPU info: $(nproc) cores"
cat /proc/cpuinfo | grep "model name" | head -1
- name: Build LocalTesting solution
run: |
echo "🔨 Building LocalTesting solution (includes all LearningCourse projects)..."
dotnet restore LocalTesting/LocalTesting.sln
dotnet build LocalTesting/LocalTesting.sln --configuration Release --no-restore
- name: Build LearningCourse IntegrationTests solution
run: |
echo "🔨 Building LearningCourse IntegrationTests solution..."
dotnet restore LearningCourse/IntegrationTests.sln
dotnet build LearningCourse/IntegrationTests.sln --configuration Release --no-restore
- name: Run LearningCourse Integration Tests
timeout-minutes: 25 # Increased timeout for CI environment with LEARNINGCOURSE mode
run: |
echo "=== Starting LearningCourse Integration Tests ==="
dotnet test LearningCourse/IntegrationTests.sln --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=LearningCourseTestResults.trx" --results-directory TestResults
env:
DOTNET_ENVIRONMENT: Testing
ASPIRE_ALLOW_UNSECURED_TRANSPORT: "true"
DOCKER_HOST: "unix:///var/run/docker.sock"
LEARNINGCOURSE: "true" # Enable Redis and Observability infrastructure
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: LearningCourseTestResults
path: TestResults/
if: always()
- name: Show Docker containers (diagnostic)
if: always()
run: |
echo "=== Docker containers status ==="
docker ps -a
echo "=== Docker logs for Kafka ==="
docker logs $(docker ps -aq --filter "name=kafka") 2>&1 | tail -100 || echo "No Kafka container found"
echo "=== Docker logs for Flink JobManager ==="
docker logs $(docker ps -aq --filter "name=flink-jobmanager") 2>&1 | tail -100 || echo "No Flink JobManager container found"
echo "=== Docker logs for Redis ==="
docker logs $(docker ps -aq --filter "name=redis") 2>&1 | tail -100 || echo "No Redis container found"
echo "=== Docker logs for Prometheus ==="
docker logs $(docker ps -aq --filter "name=prometheus") 2>&1 | tail -100 || echo "No Prometheus container found"
- name: Cleanup
if: always()
run: |
docker system prune -f || true
docker volume prune -f || true