Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(uplink): Ensure string input for b64enc in secret.yaml #686

Merged
merged 14 commits into from
Sep 12, 2023
2 changes: 1 addition & 1 deletion charts/uplink/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
{{ include "uplink.labels" . | indent 4 }}
data:
postgresql.url: {{ .Values.postgresql.url | b64enc }}
postgresql.url: "{{ .Values.postgresql.url | b64enc }}"
client.id: {{ .Values.client.id | b64enc }}
client.secret: {{ .Values.client.secret | b64enc }}
sentry.dsn: {{ .Values.sentry.dsn | b64enc }}
40 changes: 40 additions & 0 deletions charts/uplink/templates/tests/secret_test.yaml
Original file line number Diff line number Diff line change
@@ -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"
Sathwik-git marked this conversation as resolved.
Show resolved Hide resolved
asserts:
- isKind:
of: Secret
- matchRegex:
path: metadata.name
pattern: "^uplink.*" # Assumes the "uplink.fullname" template results in names starting with "uplink"
Sathwik-git marked this conversation as resolved.
Show resolved Hide resolved
- 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...