curl.yaml 1.64 KB
Newer Older
Sandro Mathys's avatar
Sandro Mathys committed
1
{{- if .Values.tests.enabled }}
Sandro Mathys's avatar
Sandro Mathys committed
2
3
4
5
---
apiVersion: v1
kind: Pod
metadata:
Sandro Mathys's avatar
Sandro Mathys committed
6
  name: {{ include "shibboleth-sp.fullname" . }}-helm-test-curl
Sandro Mathys's avatar
Sandro Mathys committed
7
8
9
  annotations:
    "helm.sh/hook": test
spec:
Sandro Mathys's avatar
Sandro Mathys committed
10
  {{- if .Values.tests.imagePullSecrets }}
11
  imagePullSecrets:
Sandro Mathys's avatar
Sandro Mathys committed
12
  {{- with .Values.tests.imagePullSecrets }}
Sandro Mathys's avatar
Sandro Mathys committed
13
    {{- toYaml . | nindent 4 }}
Sandro Mathys's avatar
Sandro Mathys committed
14
15
  {{- end }}
  {{- end }}
Sandro Mathys's avatar
Sandro Mathys committed
16
17
18
  containers:
    # check apache is responding
    - name: root
Sandro Mathys's avatar
Sandro Mathys committed
19
20
      image: "{{ include "shibboleth-sp.tests.image" . }}"
      imagePullPolicy: "{{ include "shibboleth-sp.tests.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
      command:
        - "sh"
        - "-c"
        - |
          curl --fail http://{{ include "shibboleth-sp.fullname" . }} -D /tmp/header.out -o /tmp/document.out
          echo "### HEADER ###"
          cat /tmp/header.out
          echo "### DOCUMENT ###"
          cat /tmp/document.out
          echo "### TESTS ###"
          grep "302 Found" /tmp/header.out
          grep "Location: https://wayf.switch.ch/SWITCHaai/WAYF" /tmp/header.out
    # check shibboleth is responding
    - name: session
Sandro Mathys's avatar
Sandro Mathys committed
35
36
      image: "{{ include "shibboleth-sp.tests.image" . }}"
      imagePullPolicy: "{{ include "shibboleth-sp.tests.imagePullPolicy" . }}"
Sandro Mathys's avatar
Sandro Mathys committed
37
38
39
40
41
42
43
44
45
46
47
48
49
      command:
        - "sh"
        - "-c"
        - |
          curl --fail http://{{ include "shibboleth-sp.fullname" . }}/Shibboleth.sso/Session -D /tmp/header.out -o /tmp/document.out
          echo "### HEADER ###"
          cat /tmp/header.out
          echo "### DOCUMENT ###"
          cat /tmp/document.out
          echo "### TESTS ###"
          grep "200 OK" /tmp/header.out
          grep "A valid session was not found." /tmp/document.out
  restartPolicy: Never
Sandro Mathys's avatar
Sandro Mathys committed
50
{{- end -}}