From b7cce677df48d0f0bfdc88cdfc6bec96f55f390f Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 12:25:08 +0000 Subject: [PATCH 1/7] Try and add a basic test to see if anything happens --- .../templates/test/test-connection.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 charts/sorry-cypress/templates/test/test-connection.yaml diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml new file mode 100644 index 0000000..b6d6bbc --- /dev/null +++ b/charts/sorry-cypress/templates/test/test-connection.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "nginx-helm.fullname" . }}-test-api-connection" + labels: + app.kubernetes.io/name: {{ include "nginx-helm.name" . }} + helm.sh/chart: {{ include "nginx-helm.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + "helm.sh/hook": test-success + "helm.sh/hook-delete-policy": hook-succeeded +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "nginx-helm.fullname" . }}:{{ .Values.api.service.port }}'] + restartPolicy: Never \ No newline at end of file From e94f2ef56b27e57bdc1491ce23f271deff7ffcd8 Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 12:38:44 +0000 Subject: [PATCH 2/7] Now with various copy/paste errors removed --- charts/sorry-cypress/templates/test/test-connection.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml index b6d6bbc..6ab7fd3 100644 --- a/charts/sorry-cypress/templates/test/test-connection.yaml +++ b/charts/sorry-cypress/templates/test/test-connection.yaml @@ -1,10 +1,10 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "nginx-helm.fullname" . }}-test-api-connection" + name: "{{ include "sorry-cypress-helm.fullname" . }}-test-api-connection" labels: - app.kubernetes.io/name: {{ include "nginx-helm.name" . }} - helm.sh/chart: {{ include "nginx-helm.chart" . }} + app.kubernetes.io/name: {{ include "sorry-cypress-helm.fullname" . }} + helm.sh/chart: {{ include "sorry-cypress-helmchart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} annotations: @@ -15,5 +15,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "nginx-helm.fullname" . }}:{{ .Values.api.service.port }}'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}:{{ .Values.api.service.port }}'] restartPolicy: Never \ No newline at end of file From b4089049045945f360a9b4892cc0488d0067938e Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 12:40:32 +0000 Subject: [PATCH 3/7] Keep removing stuff until something happens --- charts/sorry-cypress/templates/test/test-connection.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml index 6ab7fd3..eb3e384 100644 --- a/charts/sorry-cypress/templates/test/test-connection.yaml +++ b/charts/sorry-cypress/templates/test/test-connection.yaml @@ -4,9 +4,6 @@ metadata: name: "{{ include "sorry-cypress-helm.fullname" . }}-test-api-connection" labels: app.kubernetes.io/name: {{ include "sorry-cypress-helm.fullname" . }} - helm.sh/chart: {{ include "sorry-cypress-helmchart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/managed-by: {{ .Release.Service }} annotations: "helm.sh/hook": test-success "helm.sh/hook-delete-policy": hook-succeeded From d908bb6498d6884d894a5214b1650f8724b7575b Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 12:53:41 +0000 Subject: [PATCH 4/7] It helps if you get the service name right --- charts/sorry-cypress/templates/test/test-connection.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml index eb3e384..4fdda83 100644 --- a/charts/sorry-cypress/templates/test/test-connection.yaml +++ b/charts/sorry-cypress/templates/test/test-connection.yaml @@ -12,5 +12,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "sorry-cypress-helm.fullname" . }}:{{ .Values.api.service.port }}'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}-api:{{ .Values.api.service.port }}'] restartPolicy: Never \ No newline at end of file From bf78b3e4f8a0f8bf68c26a75a49049488a2ba40a Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 13:12:27 +0000 Subject: [PATCH 5/7] Turns out I really shouldn't have picked the API first --- charts/sorry-cypress/templates/test/test-connection.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml index 4fdda83..b6131f6 100644 --- a/charts/sorry-cypress/templates/test/test-connection.yaml +++ b/charts/sorry-cypress/templates/test/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "sorry-cypress-helm.fullname" . }}-test-api-connection" + name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" labels: - app.kubernetes.io/name: {{ include "sorry-cypress-helm.fullname" . }} + app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" annotations: "helm.sh/hook": test-success "helm.sh/hook-delete-policy": hook-succeeded @@ -12,5 +12,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "sorry-cypress-helm.fullname" . }}-api:{{ .Values.api.service.port }}'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}-dashboard:{{ .Values.dashboard.service.port }}'] restartPolicy: Never \ No newline at end of file From b1fd6fba5b2614a3b2a2a3c5060380c577f9c691 Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 13:19:42 +0000 Subject: [PATCH 6/7] Test mongo, director and dashboard in one test --- .../templates/test/test-connection.yaml | 16 ------ .../templates/test/test-connections.yaml | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 16 deletions(-) delete mode 100644 charts/sorry-cypress/templates/test/test-connection.yaml create mode 100644 charts/sorry-cypress/templates/test/test-connections.yaml diff --git a/charts/sorry-cypress/templates/test/test-connection.yaml b/charts/sorry-cypress/templates/test/test-connection.yaml deleted file mode 100644 index b6131f6..0000000 --- a/charts/sorry-cypress/templates/test/test-connection.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" - labels: - app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" - annotations: - "helm.sh/hook": test-success - "helm.sh/hook-delete-policy": hook-succeeded -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "sorry-cypress-helm.fullname" . }}-dashboard:{{ .Values.dashboard.service.port }}'] - restartPolicy: Never \ No newline at end of file diff --git a/charts/sorry-cypress/templates/test/test-connections.yaml b/charts/sorry-cypress/templates/test/test-connections.yaml new file mode 100644 index 0000000..059e1ce --- /dev/null +++ b/charts/sorry-cypress/templates/test/test-connections.yaml @@ -0,0 +1,54 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" + labels: + app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-dashboard-connection" + annotations: + "helm.sh/hook": test-success + "helm.sh/hook-delete-policy": hook-succeeded +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}-dashboard:{{ .Values.dashboard.service.port }}'] + restartPolicy: Never +--- +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sorry-cypress-helm.fullname" . }}-test-director-connection" + labels: + app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-director-connection" + annotations: + "helm.sh/hook": test-success + "helm.sh/hook-delete-policy": hook-succeeded +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}-director:{{ .Values.director.service.port }}'] + restartPolicy: Never +--- +{{- if .Values.mongo.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongo-connection" + labels: + app.kubernetes.io/name: "{{ include "sorry-cypress-helm.fullname" . }}-test-mongo-connection" + annotations: + "helm.sh/hook": test-success + "helm.sh/hook-delete-policy": hook-succeeded +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "sorry-cypress-helm.fullname" . }}-mongo:{{ .Values.mongo.service.port }}'] + restartPolicy: Never +{{- end }} + +# Note. Not testing API yet.. can't do a 'get' on that unless there's a nice secret healthz path hidden somewhere. \ No newline at end of file From 818f671fdfe26142ca22e12da6e54786bb4928df Mon Sep 17 00:00:00 2001 From: Tim Collins Date: Tue, 2 Feb 2021 13:27:01 +0000 Subject: [PATCH 7/7] Increase chart version. Tests are passing --- charts/sorry-cypress/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/sorry-cypress/Chart.yaml b/charts/sorry-cypress/Chart.yaml index 89ea609..54837b0 100644 --- a/charts/sorry-cypress/Chart.yaml +++ b/charts/sorry-cypress/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sorry-cypress description: A Helm chart for Sorry Cypress type: application -version: 0.1.28 +version: 0.1.29 appVersion: 0.6.1 home: https://sorry-cypress.dev/ sources: