apiVersion: v1
kind: Pod
metadata:
  name: puppeteer
  namespace: puppeteer
spec:
  volumes:
    - name: test-run-results
    - name: dshm
      emptyDir:
        medium: Memory
  containers:
    # container containing the tests
    - name: puppeteer
      image: quay.io/mmusiien/puppeteer-chrome-dashboard:v1
      imagePullPolicy: Always
      command: ["/bin/sh"]
      args: ["-c", "yarn test"]
      env:
        - name: NODE_TLS_REJECT_UNAUTHORIZED
          value: '0'
        - name: BASE_URL
          value: "https://eclipse-che.apps.ocp411-mmusiie.crw-qe.com"
        - name: IDP_ITEM
          value: ""
        - name: USERNAME
          value: "admin"
        - name: USER_PASSWORD
          value: "crw4ever!"
        - name: PLATFORM
          value: "OpenShift"
      volumeMounts:
        - name: test-run-results
          mountPath: /tmp/e2e/report/
        - mountPath: /dev/shm
          name: dshm
      resources:
        requests:
          memory: "3Gi"
          cpu: "2"
        limits:
          memory: "4Gi"
          cpu: "2"
    # Download results
    - name: download-reports
      image: quay.io/instrumentisto/rsync-ssh
      imagePullPolicy: IfNotPresent
      volumeMounts:
        - name: test-run-results
          mountPath: /tmp/e2e/report/
      command: ["sh"]
      args:
        [
          "-c",
          "while true; if [[ -f /tmp/done ]]; then exit 0; fi; do sleep 1; done",
        ]
  restartPolicy: Never
