Add comprehensive e2e testing for install/uninstall scripts across platforms and Helm scenarios #1
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: E2E Tests - Sequential (Single Cluster) | |
| on: | |
| push: | |
| branches: [main, develop] | |
| paths: | |
| - 'scripts/*' | |
| - 'values/*.yaml' | |
| - '.github/workflows/e2e-sequential.yml' | |
| pull_request: | |
| branches: [main, develop] | |
| paths: | |
| - 'scripts/*' | |
| - 'values/*.yaml' | |
| - '.github/workflows/e2e-sequential.yml' | |
| workflow_dispatch: | |
| jobs: | |
| # Single Job: All tests on one cluster | |
| e2e-tests-single-cluster: | |
| name: "E2E Tests on Single Cluster" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Setup Phase | |
| - name: "Setup - Create kind cluster" | |
| uses: helm/kind-action@v1 | |
| with: | |
| cluster_name: lgtm-e2e-cluster | |
| kubectl_version: v1.28.0 | |
| - name: "Setup - Install Helm" | |
| uses: azure/setup-helm@v3 | |
| with: | |
| version: '3.13.2' | |
| - name: "Setup - Install PowerShell" | |
| run: | | |
| # Install PowerShell on Ubuntu | |
| wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb | |
| sudo dpkg -i packages-microsoft-prod.deb | |
| sudo apt-get update | |
| sudo apt-get install -y powershell | |
| - name: "Setup - Verify cluster and tools" | |
| run: | | |
| kubectl cluster-info | |
| kubectl get nodes | |
| helm version | |
| docker version | |
| pwsh --version | |
| - name: "Setup - Make scripts executable" | |
| run: | | |
| cd scripts | |
| chmod +x *.sh | |
| # Test 1: Shell Scripts with Local Helm | |
| - name: "Test 1 - Shell Scripts + Local Helm - Install" | |
| run: | | |
| echo "Starting Test 1: Shell Scripts with Local Helm" | |
| cd scripts | |
| export NAMESPACE=lgtm-test-1 | |
| export RELEASE_PREFIX=test1 | |
| ./install.sh | |
| - name: "Test 1 - Shell Scripts + Local Helm - Verify Installation" | |
| run: | | |
| echo "Verifying Test 1 installation..." | |
| # Check if all expected releases are installed | |
| helm list -n lgtm-test-1 | |
| # Quick status check | |
| kubectl get pods -n lgtm-test-1 | |
| kubectl get services -n lgtm-test-1 | |
| - name: "Test 1 - Shell Scripts + Local Helm - Health Checks" | |
| run: | | |
| echo "Running health checks for LGTM services..." | |
| # Wait a moment for services to be fully ready | |
| sleep 30 | |
| # Get service endpoints | |
| GRAFANA_PORT=$(kubectl get svc test1-grafana -n lgtm-test-1 -o jsonpath='{.spec.ports[0].nodePort}') | |
| MIMIR_PORT=$(kubectl get svc test1-mimir-nginx -n lgtm-test-1 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| LOKI_PORT=$(kubectl get svc test1-loki-gateway -n lgtm-test-1 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| TEMPO_PORT=$(kubectl get svc test1-tempo -n lgtm-test-1 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| echo "Service ports - Grafana: $GRAFANA_PORT, Mimir: $MIMIR_PORT, Loki: $LOKI_PORT, Tempo: $TEMPO_PORT" | |
| # Test Mimir health endpoint | |
| if [ ! -z "$MIMIR_PORT" ]; then | |
| echo "Testing Mimir health..." | |
| curl -f "http://localhost:$MIMIR_PORT/ready" || echo "Mimir health check failed" | |
| fi | |
| # Test Loki health endpoint | |
| if [ ! -z "$LOKI_PORT" ]; then | |
| echo "Testing Loki health..." | |
| curl -f "http://localhost:$LOKI_PORT/ready" || echo "Loki health check failed" | |
| fi | |
| # Test Tempo health endpoint | |
| if [ ! -z "$TEMPO_PORT" ]; then | |
| echo "Testing Tempo health..." | |
| curl -f "http://localhost:$TEMPO_PORT/ready" || echo "Tempo health check failed" | |
| fi | |
| # Test Grafana health | |
| if [ ! -z "$GRAFANA_PORT" ]; then | |
| echo "Testing Grafana health..." | |
| curl -f "http://localhost:$GRAFANA_PORT/api/health" || echo "Grafana health check failed" | |
| fi | |
| - name: "Test 1 - Shell Scripts + Local Helm - Uninstall" | |
| run: | | |
| echo "Uninstalling Test 1..." | |
| cd scripts | |
| export NAMESPACE=lgtm-test-1 | |
| export RELEASE_PREFIX=test1 | |
| ./uninstall.sh | |
| - name: "Test 1 - Shell Scripts + Local Helm - Verify Uninstallation" | |
| run: | | |
| echo "Verifying Test 1 uninstallation..." | |
| # Check that helm releases are removed | |
| if helm list -n lgtm-test-1 | grep -q test1; then | |
| echo "ERROR: Helm releases still exist after uninstall" | |
| helm list -n lgtm-test-1 | |
| exit 1 | |
| fi | |
| echo "Test 1 completed successfully!" | |
| # Test 2: Shell Scripts with Containerized Helm | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Prepare Environment" | |
| run: | | |
| echo "Starting Test 2: Shell Scripts with Containerized Helm" | |
| # Remove helm temporarily to test containerized mode | |
| sudo mv /usr/local/bin/helm /usr/local/bin/helm.backup || true | |
| which helm && echo "ERROR: Helm still found" && exit 1 || echo "Helm removed successfully" | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Install" | |
| run: | | |
| cd scripts | |
| export NAMESPACE=lgtm-test-2 | |
| export RELEASE_PREFIX=test2 | |
| ./install.sh | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Verify Installation" | |
| run: | | |
| echo "Verifying Test 2 installation..." | |
| # Check if all expected releases are installed using containerized helm | |
| cd scripts | |
| ./helm-container.sh list -n lgtm-test-2 | |
| # Quick status check | |
| kubectl get pods -n lgtm-test-2 | |
| kubectl get services -n lgtm-test-2 | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Health Checks" | |
| run: | | |
| echo "Running health checks for LGTM services..." | |
| # Wait a moment for services to be fully ready | |
| sleep 30 | |
| # Get service endpoints | |
| GRAFANA_PORT=$(kubectl get svc test2-grafana -n lgtm-test-2 -o jsonpath='{.spec.ports[0].nodePort}') | |
| MIMIR_PORT=$(kubectl get svc test2-mimir-nginx -n lgtm-test-2 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| LOKI_PORT=$(kubectl get svc test2-loki-gateway -n lgtm-test-2 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| TEMPO_PORT=$(kubectl get svc test2-tempo -n lgtm-test-2 -o jsonpath='{.spec.ports[0].nodePort}' 2>/dev/null || echo "") | |
| echo "Service ports - Grafana: $GRAFANA_PORT, Mimir: $MIMIR_PORT, Loki: $LOKI_PORT, Tempo: $TEMPO_PORT" | |
| # Test Mimir health endpoint | |
| if [ ! -z "$MIMIR_PORT" ]; then | |
| echo "Testing Mimir health..." | |
| curl -f "http://localhost:$MIMIR_PORT/ready" || echo "Mimir health check failed" | |
| fi | |
| # Test Loki health endpoint | |
| if [ ! -z "$LOKI_PORT" ]; then | |
| echo "Testing Loki health..." | |
| curl -f "http://localhost:$LOKI_PORT/ready" || echo "Loki health check failed" | |
| fi | |
| # Test Tempo health endpoint | |
| if [ ! -z "$TEMPO_PORT" ]; then | |
| echo "Testing Tempo health..." | |
| curl -f "http://localhost:$TEMPO_PORT/ready" || echo "Tempo health check failed" | |
| fi | |
| # Test Grafana health | |
| if [ ! -z "$GRAFANA_PORT" ]; then | |
| echo "Testing Grafana health..." | |
| curl -f "http://localhost:$GRAFANA_PORT/api/health" || echo "Grafana health check failed" | |
| fi | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Uninstall" | |
| run: | | |
| echo "Uninstalling Test 2..." | |
| cd scripts | |
| export NAMESPACE=lgtm-test-2 | |
| export RELEASE_PREFIX=test2 | |
| ./uninstall.sh | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Verify Uninstallation" | |
| run: | | |
| echo "Verifying Test 2 uninstallation..." | |
| # Check that helm releases are removed using containerized helm | |
| cd scripts | |
| if ./helm-container.sh list -n lgtm-test-2 | grep -q test2; then | |
| echo "ERROR: Helm releases still exist after uninstall" | |
| ./helm-container.sh list -n lgtm-test-2 | |
| exit 1 | |
| fi | |
| echo "Test 2 completed successfully!" | |
| - name: "Test 2 - Shell Scripts + Containerized Helm - Restore Helm" | |
| run: | | |
| # Restore helm for next tests | |
| sudo mv /usr/local/bin/helm.backup /usr/local/bin/helm || true | |
| helm version | |
| # Test 3: PowerShell Scripts with Local Helm | |
| - name: "Test 3 - PowerShell Scripts + Local Helm - Install" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Starting Test 3: PowerShell Scripts with Local Helm" | |
| cd scripts | |
| $env:NAMESPACE = "lgtm-test-3" | |
| $env:RELEASE_PREFIX = "test3" | |
| .\install.ps1 -Namespace "lgtm-test-3" -ReleasePrefix "test3" | |
| - name: "Test 3 - PowerShell Scripts + Local Helm - Verify Installation" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Verifying Test 3 installation..." | |
| # Check if all expected releases are installed | |
| helm list -n lgtm-test-3 | |
| # Quick status check | |
| kubectl get pods -n lgtm-test-3 | |
| kubectl get services -n lgtm-test-3 | |
| - name: "Test 3 - PowerShell Scripts + Local Helm - Health Checks" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Running health checks for LGTM services..." | |
| # Wait a moment for services to be fully ready | |
| Start-Sleep -Seconds 30 | |
| # Get service endpoints | |
| $GRAFANA_PORT = kubectl get svc test3-grafana -n lgtm-test-3 -o jsonpath='{.spec.ports[0].nodePort}' | |
| $MIMIR_PORT = try { kubectl get svc test3-mimir-nginx -n lgtm-test-3 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| $LOKI_PORT = try { kubectl get svc test3-loki-gateway -n lgtm-test-3 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| $TEMPO_PORT = try { kubectl get svc test3-tempo -n lgtm-test-3 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| Write-Host "Service ports - Grafana: $GRAFANA_PORT, Mimir: $MIMIR_PORT, Loki: $LOKI_PORT, Tempo: $TEMPO_PORT" | |
| # Test Mimir health endpoint | |
| if ($MIMIR_PORT) { | |
| Write-Host "Testing Mimir health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$MIMIR_PORT/ready" -UseBasicParsing } catch { Write-Host "Mimir health check failed" } | |
| } | |
| # Test Loki health endpoint | |
| if ($LOKI_PORT) { | |
| Write-Host "Testing Loki health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$LOKI_PORT/ready" -UseBasicParsing } catch { Write-Host "Loki health check failed" } | |
| } | |
| # Test Tempo health endpoint | |
| if ($TEMPO_PORT) { | |
| Write-Host "Testing Tempo health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$TEMPO_PORT/ready" -UseBasicParsing } catch { Write-Host "Tempo health check failed" } | |
| } | |
| # Test Grafana health | |
| if ($GRAFANA_PORT) { | |
| Write-Host "Testing Grafana health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$GRAFANA_PORT/api/health" -UseBasicParsing } catch { Write-Host "Grafana health check failed" } | |
| } | |
| - name: "Test 3 - PowerShell Scripts + Local Helm - Uninstall" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Uninstalling Test 3..." | |
| cd scripts | |
| $env:NAMESPACE = "lgtm-test-3" | |
| $env:RELEASE_PREFIX = "test3" | |
| .\uninstall.ps1 -Namespace "lgtm-test-3" -ReleasePrefix "test3" | |
| - name: "Test 3 - PowerShell Scripts + Local Helm - Verify Uninstallation" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Verifying Test 3 uninstallation..." | |
| # Check that helm releases are removed | |
| $releases = helm list -n lgtm-test-3 | |
| if ($releases -match "test3") { | |
| Write-Host "ERROR: Helm releases still exist after uninstall" | |
| helm list -n lgtm-test-3 | |
| exit 1 | |
| } | |
| Write-Host "Test 3 completed successfully!" | |
| # Test 4: PowerShell Scripts with Containerized Helm | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Prepare Environment" | |
| run: | | |
| echo "Starting Test 4: PowerShell Scripts with Containerized Helm" | |
| # Remove helm temporarily to test containerized mode | |
| sudo mv /usr/local/bin/helm /usr/local/bin/helm.backup || true | |
| which helm && echo "ERROR: Helm still found" && exit 1 || echo "Helm removed successfully" | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Install" | |
| shell: pwsh | |
| run: | | |
| cd scripts | |
| $env:NAMESPACE = "lgtm-test-4" | |
| $env:RELEASE_PREFIX = "test4" | |
| .\install.ps1 -Namespace "lgtm-test-4" -ReleasePrefix "test4" | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Verify Installation" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Verifying Test 4 installation..." | |
| # Check if all expected releases are installed using containerized helm | |
| cd scripts | |
| .\helm-container.ps1 list -n lgtm-test-4 | |
| # Quick status check | |
| kubectl get pods -n lgtm-test-4 | |
| kubectl get services -n lgtm-test-4 | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Health Checks" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Running health checks for LGTM services..." | |
| # Wait a moment for services to be fully ready | |
| Start-Sleep -Seconds 30 | |
| # Get service endpoints | |
| $GRAFANA_PORT = kubectl get svc test4-grafana -n lgtm-test-4 -o jsonpath='{.spec.ports[0].nodePort}' | |
| $MIMIR_PORT = try { kubectl get svc test4-mimir-nginx -n lgtm-test-4 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| $LOKI_PORT = try { kubectl get svc test4-loki-gateway -n lgtm-test-4 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| $TEMPO_PORT = try { kubectl get svc test4-tempo -n lgtm-test-4 -o jsonpath='{.spec.ports[0].nodePort}' 2>$null } catch { "" } | |
| Write-Host "Service ports - Grafana: $GRAFANA_PORT, Mimir: $MIMIR_PORT, Loki: $LOKI_PORT, Tempo: $TEMPO_PORT" | |
| # Test Mimir health endpoint | |
| if ($MIMIR_PORT) { | |
| Write-Host "Testing Mimir health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$MIMIR_PORT/ready" -UseBasicParsing } catch { Write-Host "Mimir health check failed" } | |
| } | |
| # Test Loki health endpoint | |
| if ($LOKI_PORT) { | |
| Write-Host "Testing Loki health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$LOKI_PORT/ready" -UseBasicParsing } catch { Write-Host "Loki health check failed" } | |
| } | |
| # Test Tempo health endpoint | |
| if ($TEMPO_PORT) { | |
| Write-Host "Testing Tempo health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$TEMPO_PORT/ready" -UseBasicParsing } catch { Write-Host "Tempo health check failed" } | |
| } | |
| # Test Grafana health | |
| if ($GRAFANA_PORT) { | |
| Write-Host "Testing Grafana health..." | |
| try { Invoke-WebRequest -Uri "http://localhost:$GRAFANA_PORT/api/health" -UseBasicParsing } catch { Write-Host "Grafana health check failed" } | |
| } | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Uninstall" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Uninstalling Test 4..." | |
| cd scripts | |
| $env:NAMESPACE = "lgtm-test-4" | |
| $env:RELEASE_PREFIX = "test4" | |
| .\uninstall.ps1 -Namespace "lgtm-test-4" -ReleasePrefix "test4" | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Verify Uninstallation" | |
| shell: pwsh | |
| run: | | |
| Write-Host "Verifying Test 4 uninstallation..." | |
| # Check that helm releases are removed using containerized helm | |
| cd scripts | |
| $releases = .\helm-container.ps1 list -n lgtm-test-4 | |
| if ($releases -match "test4") { | |
| Write-Host "ERROR: Helm releases still exist after uninstall" | |
| .\helm-container.ps1 list -n lgtm-test-4 | |
| exit 1 | |
| } | |
| Write-Host "Test 4 completed successfully!" | |
| - name: "Test 4 - PowerShell Scripts + Containerized Helm - Restore Helm" | |
| run: | | |
| # Restore helm for potential future use | |
| sudo mv /usr/local/bin/helm.backup /usr/local/bin/helm || true | |
| helm version | |
| # Final Summary | |
| - name: "All Tests Completed Successfully" | |
| run: | | |
| echo "All E2E tests completed successfully on single cluster!" | |
| echo "" | |
| echo "Tests completed in sequence:" | |
| echo "1. Shell Scripts + Local Helm" | |
| echo "2. Shell Scripts + Containerized Helm" | |
| echo "3. PowerShell Scripts + Local Helm" | |
| echo "4. PowerShell Scripts + Containerized Helm" | |
| echo "" | |
| echo "All tests passed - the LGTM stack is working correctly!" | |
| echo "Single cluster approach completed - much more efficient!" | |
| # Final cluster status | |
| echo "" | |
| echo "Final cluster status:" | |
| kubectl get nodes | |
| kubectl get namespaces | grep lgtm || echo "All test namespaces cleaned up" |