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

86 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/secretExporterConfig.yaml
tests:
- it: Skip rendering by using existing secret.
set:
config.exporterConfig.existingSecret.enabled: true
asserts:
- hasDocuments:
count: 0
- it: Render secret, but with no value.
asserts:
- hasDocuments:
count: 1
- equal:
path: stringData["exporterConfig.yaml"]
value: |
{}
- it: Rendering exporter config secret.
set:
config.exporterConfig.secret.exporterConfig:
auth_modules:
first:
type: userpass
userpass:
username: first_username
password: first_password
options:
sslmode: disable
asserts:
- hasDocuments:
count: 1
- containsDocument:
apiVersion: v1
kind: Secret
name: prometheus-postgres-exporter-unittest-exporter-config
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["exporterConfig.yaml"]
value: |
auth_modules:
first:
options:
sslmode: disable
type: userpass
userpass:
password: first_password
username: first_username
- it: Rendering custom annotations and labels.
set:
config.exporterConfig.secret.annotations:
foo: bar
bar: foo
config.exporterConfig.secret.labels:
foo: bar
bar: foo
asserts:
- equal:
path: metadata.annotations
value:
foo: bar
bar: foo
- isSubset:
path: metadata.labels
content:
foo: bar
bar: foo