---
apiVersion: v1
kind: Pod
metadata:
  name: {{ include "backstage.fullname" . -}}-test-app-connection
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: test-app
      image: busybox
      command:
        - /bin/sh
        - -ecx
        - |
          echo -e "===== Testing the connection with the frontend...\n"
          wget -q -O - {{ printf "%s.%s" (include "frontend.serviceName" .) .Release.Namespace | quote }}
          echo -e "\n\n===== Testing the connection with the backend...\n"
          wget -q -O - {{ printf "http://%s.%s/catalog/entities" (include "backend.serviceName" .) .Release.Namespace | quote }}
          echo -e "\n\n===== Testing the connection with the lighthouse plugin...\n"
          wget -q -O - {{ printf "%s.%s/v1/audits" (include "lighthouse.serviceName" .) .Release.Namespace | quote }}
          echo -e   "\n"
  restartPolicy: Never