prometheus-postgres-exporter/unittests/secrets/webconfig.yaml

81 lines
2.1 KiB
YAML
Raw Normal View History

2024-11-25 10:53:09 +00:00
chart:
appVersion: 0.1.0
version: 0.1.0
suite: Secret database template (basic)
release:
name: prometheus-postgres-exporter-unittest
namespace: testing
templates:
- templates/prometheus-postgres-exporter/secretWebConfig.yaml
tests:
- it: Skip rendering by using existing secret.
set:
config.webConfig.existingSecret.enabled: true
asserts:
- hasDocuments:
count: 0
- it: Skip rendering when no webConfig.yaml is defined.
set:
config.webConfig.existingSecret.enabled: false
asserts:
- hasDocuments:
count: 0
- it: Rendering database secret.
set:
config.webConfig.secret.webConfig:
tls_server_config:
cert_file: /path/to/cert.pem
client_ca_file: /path/to/ca.pem
key_file: /path/to/key.pem
asserts:
- hasDocuments:
count: 1
- containsDocument:
apiVersion: v1
kind: Secret
name: prometheus-postgres-exporter-unittest-webconfig
namespace: testing
- notExists:
path: metadata.annotations
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: prometheus-postgres-exporter
app.kubernetes.io/version: 0.1.0
helm.sh/chart: prometheus-postgres-exporter-0.1.0
- equal:
path: stringData["webConfig.yaml"]
value: |
tls_server_config:
cert_file: /path/to/cert.pem
client_ca_file: /path/to/ca.pem
key_file: /path/to/key.pem
- it: Rendering custom annotations and labels.
set:
config.webConfig.secret.annotations:
foo: bar
bar: foo
config.webConfig.secret.labels:
foo: bar
bar: foo
config.webConfig.secret.webConfig:
tls_server_config:
cert_file: /path/to/cert.pem
key_file: /path/to/key.pem
client_ca_file: /path/to/ca.pem
asserts:
- equal:
path: metadata.annotations
value:
foo: bar
bar: foo
- isSubset:
path: metadata.labels
content:
foo: bar
bar: foo