2024-11-25 10:53:09 +00:00
|
|
|
chart:
|
|
|
|
appVersion: 0.1.0
|
|
|
|
version: 0.1.0
|
|
|
|
suite: Deployment template (basic)
|
|
|
|
release:
|
|
|
|
name: prometheus-postgres-exporter-unittest
|
|
|
|
namespace: testing
|
|
|
|
templates:
|
|
|
|
- templates/prometheus-postgres-exporter/deployment.yaml
|
|
|
|
tests:
|
|
|
|
- it: Rendering default
|
|
|
|
asserts:
|
|
|
|
- hasDocuments:
|
|
|
|
count: 1
|
|
|
|
- containsDocument:
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
name: prometheus-postgres-exporter-unittest
|
|
|
|
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
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.containers[0].envFrom
|
|
|
|
content:
|
|
|
|
secretRef:
|
|
|
|
name: prometheus-postgres-exporter-unittest-database-env
|
|
|
|
|
|
|
|
- it: Test custom database secret
|
|
|
|
set:
|
|
|
|
config.database.existingSecret.enabled: true
|
|
|
|
config.database.existingSecret.secretName: custom-database-secret
|
|
|
|
asserts:
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.containers[0].envFrom
|
|
|
|
content:
|
|
|
|
secretRef:
|
|
|
|
name: custom-database-secret
|
2024-11-25 22:17:33 +00:00
|
|
|
|
|
|
|
- it: Test mount exporterConfig.yaml
|
|
|
|
set:
|
|
|
|
config.exporterConfig.existingSecret.enabled: false
|
|
|
|
config.exporterConfig.secret.exporterConfig:
|
|
|
|
foo: bar
|
|
|
|
asserts:
|
|
|
|
- equal:
|
|
|
|
path: spec.template.spec.containers[0].args
|
|
|
|
value:
|
|
|
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
|
|
|
- --web.listen-address=:9187
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
|
|
content:
|
|
|
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
|
|
|
name: config.d
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.volumes
|
|
|
|
content:
|
|
|
|
name: config.d
|
|
|
|
secret:
|
|
|
|
secretName: prometheus-postgres-exporter-unittest-exporter-config
|
|
|
|
|
|
|
|
- it: Test mount exporterConfig.yaml from secret
|
|
|
|
set:
|
|
|
|
config.exporterConfig.existingSecret.enabled: true
|
|
|
|
config.exporterConfig.existingSecret.secretName: my-secret
|
|
|
|
asserts:
|
|
|
|
- equal:
|
|
|
|
path: spec.template.spec.containers[0].args
|
|
|
|
value:
|
|
|
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
|
|
|
- --web.listen-address=:9187
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
|
|
content:
|
|
|
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
|
|
|
name: config.d
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.volumes
|
|
|
|
content:
|
|
|
|
name: config.d
|
|
|
|
secret:
|
|
|
|
secretName: my-secret
|
|
|
|
|
|
|
|
- it: Test mount webConfig.yaml
|
|
|
|
set:
|
|
|
|
config.webConfig.existingSecret.enabled: false
|
|
|
|
config.webConfig.secret.webConfig:
|
|
|
|
foo: bar
|
|
|
|
asserts:
|
|
|
|
- equal:
|
|
|
|
path: spec.template.spec.containers[0].args
|
|
|
|
value:
|
|
|
|
- --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
|
|
|
- --web.listen-address=:9187
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.containers[0].volumeMounts
|
|
|
|
content:
|
|
|
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
|
|
|
name: config.d
|
|
|
|
- contains:
|
|
|
|
path: spec.template.spec.volumes
|
|
|
|
content:
|
|
|
|
name: config.d
|
|
|
|
secret:
|
|
|
|
secretName: prometheus-postgres-exporter-unittest-web-config
|
|
|
|
|
|
|
|
# - it: Test mount webConfig.yaml from secret
|
|
|
|
# set:
|
|
|
|
# config.webConfig.existingSecret.enabled: true
|
|
|
|
# config.webConfig.existingSecret.secretName: my-secret
|
|
|
|
# asserts:
|
|
|
|
# - equal:
|
|
|
|
# path: spec.template.spec.containers[0].args
|
|
|
|
# value:
|
|
|
|
# - --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
|
|
|
# - --web.listen-address=:9187
|