diff --git a/.github/workflows/logzio-apm-collector-test.yaml b/.github/workflows/logzio-apm-collector-test.yaml new file mode 100644 index 00000000..d0c87de9 --- /dev/null +++ b/.github/workflows/logzio-apm-collector-test.yaml @@ -0,0 +1,94 @@ +name: Test `logzio-apm-collector` chart + +on: + pull_request: + branches: + - master + paths: + - 'charts/logzio-apm-collector/Chart.yaml' + - 'charts/logzio-apm-collector/templates/**' + - 'charts/logzio-apm-collector/values.yaml' +jobs: + test-helm-chart: + name: Test Helm Chart on Kind + runs-on: ubuntu-latest + steps: + - name: Generate random id + id: random_id + run: echo "::set-output name=rand::$(echo $RANDOM)" + + - name: Set ENV_ID + run: echo "ENV_ID=apm-test-run-${{ steps.random_id.outputs.rand }}" >> $GITHUB_ENV + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.20' + + - name: Set up Helm + uses: azure/setup-helm@v4.2.0 + + - name: Set up kubectl + uses: azure/setup-kubectl@v4 + + - name: Install Kind + run: | + curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.11.1/kind-Linux-amd64" + chmod +x ./kind + mv ./kind /usr/local/bin/kind + + - name: Create Kind cluster + run: | + kind create cluster --name kind-${{ github.run_id }}-${{ matrix.mode }} + kubectl cluster-info + + - name: Deploy Helm Chart + run: | + cd charts/logzio-telemetry + helm upgrade --install \ + --set enabled=true \ \ + --set spm.enabled=true \ + --set serviceGraph.enabled=true \ + --set secrets.logzioTracesToken=${{ secrets.LOGZIO_TRACES_TOKEN }} \ + --set secrets.logzioSpmToken=${{ secrets.LOGZIO_METRICS_TOKEN }} \ + --set secrets.logzioRegion="us" \ + --set secrets.env_id=${{ env.ENV_ID }} \ + logzio-apm-collector . + kubectl rollout status deployment/logzio-apm-collector --timeout=300s + kubectl rollout status deployment/logzio-apm-collector-spm --timeout=300s + + - name: Run trace generator + run: | + kubectl apply -f tests/resources/tracegen.yaml + kubectl rollout status deployment/trace-gen --timeout=300s + + - name: Run otel demo for service graph + run: | + helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts + helm repo update + helm install otel-demo -f tests/resources/otel-demo.yaml open-telemetry/opentelemetry-demo --version 0.32.5 + kubectl rollout status deployment/otel-demo-loadgenerator --timeout=300s + + - name: sleep for 3 minutes + run: sleep 180 + + - name: Run Go Tests + env: + LOGZIO_METRICS_API_KEY: ${{ secrets.LOGZIO_METRICS_API_KEY }} + LOGZIO_TRACES_API_KEY: ${{ secrets.LOGZIO_TRACES_API_KEY }} + run: | + go get go.uber.org/zap + go test -v ./tests/traces_e2e_test.go ./tests/common.go + go test -v ./tests/metrics_e2e_test.go ./tests/common.go + + - name: Cleanup Environment + run: | + helm uninstall logzio-apm-collector + + - name: Delete Kind cluster + if: always() + run: kind delete cluster --name kind-${{ github.run_id }}-${{ matrix.mode }} +