From 4759ff3ccc23bccd04405abce06dfb6228d6f1d6 Mon Sep 17 00:00:00 2001 From: Cristian Klein Date: Fri, 29 Nov 2019 22:36:14 +0100 Subject: [PATCH] feat(template): Added test for non-determinism Signed-off-by: Cristian Klein --- .../output/template-name-template.txt | 34 +++++++++++++++++++ cmd/helm/testdata/output/template-set.txt | 34 +++++++++++++++++++ .../testdata/output/template-values-files.txt | 34 +++++++++++++++++++ .../output/template-with-api-version.txt | 34 +++++++++++++++++++ cmd/helm/testdata/output/template.txt | 34 +++++++++++++++++++ .../charts/subchart1/templates/service2.yaml | 31 +++++++++++++++++ 6 files changed, 201 insertions(+) create mode 100644 pkg/chartutil/testdata/subpop/charts/subchart1/templates/service2.yaml diff --git a/cmd/helm/testdata/output/template-name-template.txt b/cmd/helm/testdata/output/template-name-template.txt index acba50360..3f3f5752a 100644 --- a/cmd/helm/testdata/output/template-name-template.txt +++ b/cmd/helm/testdata/output/template-name-template.txt @@ -53,3 +53,37 @@ spec: name: nginx selector: app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s1 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s2 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 diff --git a/cmd/helm/testdata/output/template-set.txt b/cmd/helm/testdata/output/template-set.txt index b0924b5b6..3a689c296 100644 --- a/cmd/helm/testdata/output/template-set.txt +++ b/cmd/helm/testdata/output/template-set.txt @@ -53,3 +53,37 @@ spec: name: apache selector: app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s1 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: apache + selector: + app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s2 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: apache + selector: + app.kubernetes.io/name: subchart1 diff --git a/cmd/helm/testdata/output/template-values-files.txt b/cmd/helm/testdata/output/template-values-files.txt index b0924b5b6..3a689c296 100644 --- a/cmd/helm/testdata/output/template-values-files.txt +++ b/cmd/helm/testdata/output/template-values-files.txt @@ -53,3 +53,37 @@ spec: name: apache selector: app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s1 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: apache + selector: + app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s2 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: apache + selector: + app.kubernetes.io/name: subchart1 diff --git a/cmd/helm/testdata/output/template-with-api-version.txt b/cmd/helm/testdata/output/template-with-api-version.txt index da3559082..a0fd4bf3f 100644 --- a/cmd/helm/testdata/output/template-with-api-version.txt +++ b/cmd/helm/testdata/output/template-with-api-version.txt @@ -54,3 +54,37 @@ spec: name: nginx selector: app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s1 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s2 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 diff --git a/cmd/helm/testdata/output/template.txt b/cmd/helm/testdata/output/template.txt index 080be618c..de2da578d 100644 --- a/cmd/helm/testdata/output/template.txt +++ b/cmd/helm/testdata/output/template.txt @@ -53,3 +53,37 @@ spec: name: nginx selector: app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s1 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 +--- +# Source: subchart1/templates/service2.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1-s2 + labels: + helm.sh/chart: "subchart1-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service2.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service2.yaml new file mode 100644 index 000000000..62f4886e2 --- /dev/null +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service2.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-s1 + labels: + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app.kubernetes.io/name: {{ .Chart.Name }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-s2 + labels: + helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app.kubernetes.io/name: {{ .Chart.Name }}