From 5964957640adcefc59f792813e79a9f2796f8c33 Mon Sep 17 00:00:00 2001 From: Frank Kloeker Date: Sat, 2 Dec 2023 18:59:47 +0100 Subject: [PATCH] add end2end test Signed-off-by: Frank Kloeker --- .github/workflows/end2end.yaml | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/end2end.yaml diff --git a/.github/workflows/end2end.yaml b/.github/workflows/end2end.yaml new file mode 100644 index 00000000..5c1bf78d --- /dev/null +++ b/.github/workflows/end2end.yaml @@ -0,0 +1,79 @@ +# This workflow installs 1 instance of sparrow and +# verify the API output + +name: End2End Testing +on: + push: + paths: + - 'chart/**' + +jobs: + end2end: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Set up K3S + uses: debianmaster/actions-k3s@master + id: k3s + with: + version: 'v1.26.9-k3s1' + - name: Check Cluster + run: | + kubectl get nodes + - name: Check Coredns Deployment + run: | + kubectl -n kube-system rollout status deployment/coredns --timeout=60s + STATUS=$(kubectl -n kube-system get deployment coredns -o jsonpath={.status.readyReplicas}) + if [[ $STATUS -ne 1 ]] + then + echo "Deployment coredns not ready" + kubectl -n kube-system get events + exit 1 + else + echo "Deployment coredns OK" + fi + - name: Check Metricsserver Deployment + run: | + kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s + STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas}) + if [[ $STATUS -ne 1 ]] + then + echo "Deployment metrics-server not ready" + kubectl -n kube-system get events + exit 1 + else + echo "Deployment metrics-server OK" + fi + - name: Setup Helm + run: | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + helm version + - name: Install Sparrow + run: | + helm upgrade -i sparrow \ + --atomic \ + --timeout 300s \ + --set sparrow.loaderType=file \ + chart + - name: Check Pods + run: | + kubectl get pods + - name: Wait for Sparrow + run: | + sleep 60 + - name: Check Sparrow + run: | + kubectl create job curl --image=mtr.devops.telekom.de/mcsps/curl:7.65.3 -- curl -f -v -H 'Content-Type: application/json' http://sparrow:8080/v1/metrics/health + kubectl wait --for=condition=complete job/curl + STATUS=$(kubectl get job curl -o jsonpath={.status.succeeded}) + if [[ $STATUS -ne 1 ]] + then + echo "Job failed" + kubectl logs -ljob-name=curl + kubectl delete job curl + exit 1 + else + echo "Job OK" + kubectl delete job curl + fi