From d5e6ee65a50bd6444edbe36afef41fcad441c90a Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:18:58 +0530 Subject: [PATCH 01/10] Update secret.yaml changed this (.Values.postgresql.url) into a string --- charts/uplink/templates/secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/uplink/templates/secret.yaml b/charts/uplink/templates/secret.yaml index 339812a5a..f09912bc9 100644 --- a/charts/uplink/templates/secret.yaml +++ b/charts/uplink/templates/secret.yaml @@ -5,7 +5,7 @@ metadata: labels: {{ include "uplink.labels" . | indent 4 }} data: - postgresql.url: {{ .Values.postgresql.url | b64enc }} + postgresql.url: {{ .Values.postgresql.url | quote }} client.id: {{ .Values.client.id | b64enc }} client.secret: {{ .Values.client.secret | b64enc }} sentry.dsn: {{ .Values.sentry.dsn | b64enc }} From 9f0f2d0a795403f04bf387f3ced6ecde06d6765c Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:43:24 +0530 Subject: [PATCH 02/10] Create secret_test.yaml Added Unit tests --- .../uplink/templates/tests/secret_test.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 charts/uplink/templates/tests/secret_test.yaml diff --git a/charts/uplink/templates/tests/secret_test.yaml b/charts/uplink/templates/tests/secret_test.yaml new file mode 100644 index 000000000..ce7459eaf --- /dev/null +++ b/charts/uplink/templates/tests/secret_test.yaml @@ -0,0 +1,40 @@ +suite: test secret.yaml +templates: + - secret.yaml +tests: + - it: should ensure the secret has correct metadata + set: + postgresql.url: "example-url" + client.id: "example-id" + client.secret: "example-secret" + sentry.dsn: "example-dsn" + asserts: + - isKind: + of: Secret + - matchRegex: + path: metadata.name + pattern: "^uplink.*" # Assumes the "uplink.fullname" template results in names starting with "uplink" + - hasDocuments: + count: 1 + + - it: should check data fields in secret + set: + postgresql.url: "example-url" + client.id: "example-id" + client.secret: "example-secret" + sentry.dsn: "example-dsn" + asserts: + - equal: + path: data.postgresql.url + value: "example-url" + - equal: + path: data.client.id + value: "ZXhhbXBsZS1pZA==" # Base64 encoded value of "example-id" + - equal: + path: data.client.secret + value: "ZXhhbXBsZS1zZWNyZXQ=" # Base64 encoded value of "example-secret" + - equal: + path: data.sentry.dsn + value: "ZXhhbXBsZS1kc24=" # Base64 encoded value of "example-dsn" + + # Add more tests as required... From 05bbca185a88f555cfc7b8cbaaedd42308dacecb Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:49:32 +0530 Subject: [PATCH 03/10] Update secret.yaml --- charts/uplink/templates/secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/uplink/templates/secret.yaml b/charts/uplink/templates/secret.yaml index f09912bc9..531d70cb5 100644 --- a/charts/uplink/templates/secret.yaml +++ b/charts/uplink/templates/secret.yaml @@ -5,7 +5,7 @@ metadata: labels: {{ include "uplink.labels" . | indent 4 }} data: - postgresql.url: {{ .Values.postgresql.url | quote }} + postgresql.url: "{{ .Values.postgresql.url | b64enc }}" client.id: {{ .Values.client.id | b64enc }} client.secret: {{ .Values.client.secret | b64enc }} sentry.dsn: {{ .Values.sentry.dsn | b64enc }} From ee8d1f36d610597be63036b95d85b295fe86268a Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:08:44 +0530 Subject: [PATCH 04/10] Update charts/uplink/templates/tests/secret_test.yaml Co-authored-by: Damien Duportal --- charts/uplink/templates/tests/secret_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/uplink/templates/tests/secret_test.yaml b/charts/uplink/templates/tests/secret_test.yaml index ce7459eaf..970efb052 100644 --- a/charts/uplink/templates/tests/secret_test.yaml +++ b/charts/uplink/templates/tests/secret_test.yaml @@ -11,9 +11,9 @@ tests: asserts: - isKind: of: Secret - - matchRegex: + - equal: path: metadata.name - pattern: "^uplink.*" # Assumes the "uplink.fullname" template results in names starting with "uplink" + value: "RELEASE-NAME-uplink." - hasDocuments: count: 1 From 2180fc97ae961c9aac6f3e4e7d25324e9c440cd1 Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:09:15 +0530 Subject: [PATCH 05/10] Update charts/uplink/templates/tests/secret_test.yaml Co-authored-by: Damien Duportal --- charts/uplink/templates/tests/secret_test.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/charts/uplink/templates/tests/secret_test.yaml b/charts/uplink/templates/tests/secret_test.yaml index 970efb052..453bc38ad 100644 --- a/charts/uplink/templates/tests/secret_test.yaml +++ b/charts/uplink/templates/tests/secret_test.yaml @@ -3,11 +3,6 @@ templates: - secret.yaml tests: - it: should ensure the secret has correct metadata - set: - postgresql.url: "example-url" - client.id: "example-id" - client.secret: "example-secret" - sentry.dsn: "example-dsn" asserts: - isKind: of: Secret From cc380e16692ac2298ec4d09679867d425a7bc327 Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:52:29 +0530 Subject: [PATCH 06/10] Update secret.yaml --- charts/uplink/templates/secret.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/uplink/templates/secret.yaml b/charts/uplink/templates/secret.yaml index 531d70cb5..0033d1dcc 100644 --- a/charts/uplink/templates/secret.yaml +++ b/charts/uplink/templates/secret.yaml @@ -5,7 +5,7 @@ metadata: labels: {{ include "uplink.labels" . | indent 4 }} data: - postgresql.url: "{{ .Values.postgresql.url | b64enc }}" + postgresql.url: {{ .Values.postgresql.url | toString | b64enc }} client.id: {{ .Values.client.id | b64enc }} client.secret: {{ .Values.client.secret | b64enc }} sentry.dsn: {{ .Values.sentry.dsn | b64enc }} From 6837581922b4fd607aec6d5c79cae591a978c1fc Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 13:58:36 +0530 Subject: [PATCH 07/10] Update secret_test.yaml --- .../uplink/templates/tests/secret_test.yaml | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/charts/uplink/templates/tests/secret_test.yaml b/charts/uplink/templates/tests/secret_test.yaml index 453bc38ad..d32e8e665 100644 --- a/charts/uplink/templates/tests/secret_test.yaml +++ b/charts/uplink/templates/tests/secret_test.yaml @@ -3,14 +3,20 @@ templates: - secret.yaml tests: - it: should ensure the secret has correct metadata + set: + postgresql.url: "example-url" + client.id: "example-id" + client.secret: "example-secret" + sentry.dsn: "example-dsn" asserts: - isKind: of: Secret + - matchRegex: + path: metadata.name + pattern: "^uplink.*" # General check to ensure name starts with "uplink" - equal: path: metadata.name - value: "RELEASE-NAME-uplink." - - hasDocuments: - count: 1 + value: "RELEASE-NAME-uplink." # Specific check for the exact name - it: should check data fields in secret set: @@ -21,15 +27,15 @@ tests: asserts: - equal: path: data.postgresql.url - value: "example-url" + value: "ZXhhbXBsZS11cmw=" # Base64 encoded value of "example-url" - equal: path: data.client.id - value: "ZXhhbXBsZS1pZA==" # Base64 encoded value of "example-id" + value: "ZXhhbXBsZS1pZA==" # Base64 encoded value of "example-id" - equal: path: data.client.secret - value: "ZXhhbXBsZS1zZWNyZXQ=" # Base64 encoded value of "example-secret" + value: "ZXhhbXBsZS1zZWNyZXQ=" # Base64 encoded value of "example-secret" - equal: path: data.sentry.dsn - value: "ZXhhbXBsZS1kc24=" # Base64 encoded value of "example-dsn" + value: "ZXhhbXBsZS1kc24=" # Base64 encoded value of "example-dsn" # Add more tests as required... From 19d9c8c6740bbc0e2cb7a75ca4ecb9f68b08751a Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:04:40 +0530 Subject: [PATCH 08/10] Create defaults_test.yaml --- .../uplink/templates/tests/defaults_test.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 charts/uplink/templates/tests/defaults_test.yaml diff --git a/charts/uplink/templates/tests/defaults_test.yaml b/charts/uplink/templates/tests/defaults_test.yaml new file mode 100644 index 000000000..e6e5b8583 --- /dev/null +++ b/charts/uplink/templates/tests/defaults_test.yaml @@ -0,0 +1,25 @@ +suite: test default behavior of secret.yaml with default values +templates: + - secret.yaml +tests: + - it: should render with default values without error + asserts: + - isKind: + of: Secret + - matchRegex: + path: metadata.name + pattern: "^uplink.*" # Assuming the default behavior still starts with "uplink" + - notMatchRegex: + path: data.postgresql.url + pattern: "." # Assuming no default value provided + - notMatchRegex: + path: data.client.id + pattern: "." # Assuming no default value provided + - notMatchRegex: + path: data.client.secret + pattern: "." # Assuming no default value provided + - notMatchRegex: + path: data.sentry.dsn + pattern: "." # Assuming no default value provided + + # Add more tests as required to check default behavior... From 101ae8e9e1f9a09471e41ee15e131e4db5ad4dba Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:08:46 +0530 Subject: [PATCH 09/10] Rename secret_test.yaml to custom_values_test.yaml --- .../templates/tests/{secret_test.yaml => custom_values_test.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename charts/uplink/templates/tests/{secret_test.yaml => custom_values_test.yaml} (100%) diff --git a/charts/uplink/templates/tests/secret_test.yaml b/charts/uplink/templates/tests/custom_values_test.yaml similarity index 100% rename from charts/uplink/templates/tests/secret_test.yaml rename to charts/uplink/templates/tests/custom_values_test.yaml From 0f6703f7d8f2a412dfcad7215282ffb6a6fab846 Mon Sep 17 00:00:00 2001 From: Sathwik Bodakuntla <126125648+Sathwik-git@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:14:11 +0530 Subject: [PATCH 10/10] Update Chart.yaml --- charts/uplink/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/uplink/Chart.yaml b/charts/uplink/Chart.yaml index 78f876429..52ecf0d62 100644 --- a/charts/uplink/Chart.yaml +++ b/charts/uplink/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for uplink.jenkins.io name: uplink -version: 0.1.2 +version: 0.1.3 maintainers: - name: olblak