aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/mock_files/mock_charts
diff options
context:
space:
mode:
authorKonrad Bańka <k.banka@samsung.com>2020-11-12 09:13:37 +0100
committerKonrad Bańka <k.banka@samsung.com>2020-11-18 14:16:29 +0100
commit8c86f56defd56c5ea02eb6952ba4b852599100d5 (patch)
tree22914b5a493ffdff2f540354e38019869976cbcb /src/k8splugin/mock_files/mock_charts
parent0c352ef0d74d4b51a0fce5123b34a6753e8ab6a4 (diff)
Improve early-detection of empty template
Previous empty template detection pattern matched only against templates resolved to empty-or-whitespace-only files. This change makes it handle other case of empty yaml correctly, namely, yaml containing comments only. Issue-ID: MULTICLOUD-1252 Signed-off-by: Konrad Bańka <k.banka@samsung.com> Change-Id: I9132e167ec607c8a4a4ca5584141ed043c6ddd4f
Diffstat (limited to 'src/k8splugin/mock_files/mock_charts')
-rw-r--r--src/k8splugin/mock_files/mock_charts/testchart3/Chart.yaml4
-rw-r--r--src/k8splugin/mock_files/mock_charts/testchart3/templates/always-empty.yaml9
-rw-r--r--src/k8splugin/mock_files/mock_charts/testchart3/templates/multi.yaml34
-rw-r--r--src/k8splugin/mock_files/mock_charts/testchart3/templates/only-comment.yaml6
-rw-r--r--src/k8splugin/mock_files/mock_charts/testchart3/values.yaml1
5 files changed, 54 insertions, 0 deletions
diff --git a/src/k8splugin/mock_files/mock_charts/testchart3/Chart.yaml b/src/k8splugin/mock_files/mock_charts/testchart3/Chart.yaml
new file mode 100644
index 00000000..adf4e2fe
--- /dev/null
+++ b/src/k8splugin/mock_files/mock_charts/testchart3/Chart.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+description: A Helm chart for Kubernetes
+name: testchart3
+version: 0.1.0
diff --git a/src/k8splugin/mock_files/mock_charts/testchart3/templates/always-empty.yaml b/src/k8splugin/mock_files/mock_charts/testchart3/templates/always-empty.yaml
new file mode 100644
index 00000000..121130fc
--- /dev/null
+++ b/src/k8splugin/mock_files/mock_charts/testchart3/templates/always-empty.yaml
@@ -0,0 +1,9 @@
+---
+{{ if eq 0 1 }}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dummy
+data:
+ key1: value1
+{{ end }}
diff --git a/src/k8splugin/mock_files/mock_charts/testchart3/templates/multi.yaml b/src/k8splugin/mock_files/mock_charts/testchart3/templates/multi.yaml
new file mode 100644
index 00000000..0539cfb4
--- /dev/null
+++ b/src/k8splugin/mock_files/mock_charts/testchart3/templates/multi.yaml
@@ -0,0 +1,34 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dummy
+data:
+ key1: value1
+---
+{{ if .Values.goingEmpty }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: dummy
+spec:
+ template:
+ metadata:
+ labels:
+ app: dummy
+ spec:
+ container:
+ - name: dummy
+ image: dummy
+{{ end }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: dummy
+spec:
+ ports:
+ - port: 80
+ protocol: TCP
+ selector:
+ app: dummy
diff --git a/src/k8splugin/mock_files/mock_charts/testchart3/templates/only-comment.yaml b/src/k8splugin/mock_files/mock_charts/testchart3/templates/only-comment.yaml
new file mode 100644
index 00000000..aaacc787
--- /dev/null
+++ b/src/k8splugin/mock_files/mock_charts/testchart3/templates/only-comment.yaml
@@ -0,0 +1,6 @@
+#not so empty?
+#Copyright or something similiar
+#Some license info
+{{/*
+ empty
+*/}}
diff --git a/src/k8splugin/mock_files/mock_charts/testchart3/values.yaml b/src/k8splugin/mock_files/mock_charts/testchart3/values.yaml
new file mode 100644
index 00000000..912d0dbc
--- /dev/null
+++ b/src/k8splugin/mock_files/mock_charts/testchart3/values.yaml
@@ -0,0 +1 @@
+goingEmpty: true