You've already forked prometheus-postgres-exporter
							
							
		
			
				
	
	
		
			630 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			630 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| chart:
 | |
|   appVersion: 0.1.0
 | |
|   version: 0.1.0
 | |
| suite: Deployment template (basic)
 | |
| release:
 | |
|   name: prometheus-postgres-exporter-unittest
 | |
|   namespace: testing
 | |
| templates:
 | |
| - templates/deployment.yaml
 | |
| - templates/secretDatabase.yaml
 | |
| - templates/secretExporterConfig.yaml
 | |
| - templates/secretWebConfig.yaml
 | |
| tests:
 | |
| - it: Rendering default
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
|   asserts:
 | |
|   - hasDocuments:
 | |
|       count: 1
 | |
|     template: templates/deployment.yaml
 | |
|   - containsDocument:
 | |
|       apiVersion: apps/v1
 | |
|       kind: Deployment
 | |
|       name: prometheus-postgres-exporter-unittest
 | |
|       namespace: testing
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: metadata.annotations
 | |
|     template: templates/deployment.yaml
 | |
|   - 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
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.replicas
 | |
|       value: 1
 | |
|     template: templates/deployment.yaml
 | |
|   - exists:
 | |
|       path: spec.template.metadata.annotations.checksum/secret-database
 | |
|     template: templates/deployment.yaml
 | |
|   - exists:
 | |
|       path: spec.template.metadata.annotations.checksum/secret-exporter-config
 | |
|     template: templates/deployment.yaml
 | |
|   - exists:
 | |
|       path: spec.template.metadata.annotations.checksum/secret-web-config
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.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
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.affinity
 | |
|     template: templates/deployment.yaml
 | |
|   - contains:
 | |
|       path: spec.template.spec.containers[0].envFrom
 | |
|       content:
 | |
|         secretRef:
 | |
|           name: prometheus-postgres-exporter-unittest-database-env
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].args
 | |
|       value:
 | |
|       - --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
 | |
|       - --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
 | |
|       - --web.listen-address=:9187
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - mountPath: /etc/prometheus-postgres-exporter/config.d
 | |
|         name: config-d
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - name: config-d
 | |
|         projected:
 | |
|           defaultMode: 444
 | |
|           sources:
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-exporter-config
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-web-config
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].image
 | |
|       value: quay.io/prometheuscommunity/postgres-exporter:v0.1.0
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].imagePullPolicy
 | |
|       value: IfNotPresent
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.containers[0].resources
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.containers[0].securityContext
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.dnsConfig
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.dnsPolicy
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.hostname
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostNetwork
 | |
|       value: false
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.imagePullSecrets
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.nodeSelector
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.priorityClassName
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.restartPolicy
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.subdomain
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.terminationGracePeriodSeconds
 | |
|       value: 60
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.tolerations
 | |
|     template: templates/deployment.yaml
 | |
|   - notExists:
 | |
|       path: spec.template.spec.topologySpreadConstraints
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.strategy
 | |
|       value:
 | |
|         type: "RollingUpdate"
 | |
|         rollingUpdate:
 | |
|           maxSurge: 1
 | |
|           maxUnavailable: 1
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom replicas
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.replicas: 3
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.replicas
 | |
|       value: 3
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom affinity
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.affinity:
 | |
|       nodeAffinity:
 | |
|         requiredDuringSchedulingIgnoredDuringExecution:
 | |
|           nodeSelectorTerms:
 | |
|           - matchExpressions:
 | |
|             - key: topology.kubernetes.io/zone
 | |
|               operator: In
 | |
|               values:
 | |
|               - antarctica-east1
 | |
|               - antarctica-west1
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.affinity
 | |
|       value:
 | |
|         nodeAffinity:
 | |
|           requiredDuringSchedulingIgnoredDuringExecution:
 | |
|             nodeSelectorTerms:
 | |
|             - matchExpressions:
 | |
|               - key: topology.kubernetes.io/zone
 | |
|                 operator: In
 | |
|                 values:
 | |
|                 - antarctica-east1
 | |
|                 - antarctica-west1
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test additional arguments
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.args:
 | |
|     - "--foo=bar"
 | |
|     - "--bar=foo"
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].args
 | |
|       value:
 | |
|       - --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
 | |
|       - --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
 | |
|       - --web.listen-address=:9187
 | |
|       - --foo=bar
 | |
|       - --bar=foo
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom imageRegistry and imageRepository
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.image.registry: registry.example.local
 | |
|     deployment.postgresExporter.image.repository: path/special/prometheus-postgres-exporter
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].image
 | |
|       value: registry.example.local/path/special/prometheus-postgres-exporter:v0.1.0
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom imagePullPolicy
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.image.pullPolicy: Always
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].imagePullPolicy
 | |
|       value: Always
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test config.database.existingSecret
 | |
|   set:
 | |
|     # Normal test values
 | |
|     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
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test config.exporterConfig.existingSecret
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     config.exporterConfig.existingSecret.enabled: true
 | |
|     config.exporterConfig.existingSecret.secretName: exporter-config-secret
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - mountPath: /etc/prometheus-postgres-exporter/config.d
 | |
|         name: config-d
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - name: config-d
 | |
|         projected:
 | |
|           defaultMode: 444
 | |
|           sources:
 | |
|           - secret:
 | |
|               name: exporter-config-secret
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-web-config
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test config.webConfig.existingSecret
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     config.webConfig.existingSecret.enabled: true
 | |
|     config.webConfig.existingSecret.secretName: web-config-secret
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - mountPath: /etc/prometheus-postgres-exporter/config.d
 | |
|         name: config-d
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - name: config-d
 | |
|         projected:
 | |
|           defaultMode: 444
 | |
|           sources:
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-exporter-config
 | |
|           - secret:
 | |
|               name: web-config-secret
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom resource limits and requests
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.resources:
 | |
|       limits:
 | |
|         cpu: 100m
 | |
|         memory: 250MB
 | |
|       requests:
 | |
|         cpu: 25m
 | |
|         memory: 100MB
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].env
 | |
|       value:
 | |
|       - name: GOMAXPROCS
 | |
|         valueFrom:
 | |
|           resourceFieldRef:
 | |
|             divisor: "1"
 | |
|             resource: limits.cpu
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].resources
 | |
|       value:
 | |
|         limits:
 | |
|           cpu: 100m
 | |
|           memory: 250MB
 | |
|         requests:
 | |
|           cpu: 25m
 | |
|           memory: 100MB
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test custom securityContext
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.securityContext:
 | |
|       capabilities:
 | |
|         add:
 | |
|         - NET_RAW
 | |
|         drop:
 | |
|         - ALL
 | |
|       privileged: false
 | |
|       readOnlyRootFilesystem: true
 | |
|       runAsNonRoot: true
 | |
|       runAsUser: 1000
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].securityContext
 | |
|       value:
 | |
|         capabilities:
 | |
|           add:
 | |
|           - NET_RAW
 | |
|           drop:
 | |
|           - ALL
 | |
|         privileged: false
 | |
|         readOnlyRootFilesystem: true
 | |
|         runAsNonRoot: true
 | |
|         runAsUser: 1000
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test dnsConfig
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.dnsConfig:
 | |
|       nameservers:
 | |
|       - "8.8.8.8"
 | |
|       - "8.8.4.4"
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.dnsConfig
 | |
|       value:
 | |
|         nameservers:
 | |
|         - "8.8.8.8"
 | |
|         - "8.8.4.4"
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test dnsPolicy
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.dnsPolicy: ClusterFirst
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.dnsPolicy
 | |
|       value: ClusterFirst
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test hostNetwork, hostname, subdomain
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.hostNetwork: true
 | |
|     deployment.hostname: pg-exporter
 | |
|     deployment.subdomain: exporters.internal
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostNetwork
 | |
|       value: true
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.hostname
 | |
|       value: pg-exporter
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.subdomain
 | |
|       value: exporters.internal
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test imagePullSecrets
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.imagePullSecrets:
 | |
|     - name: my-pull-secret
 | |
|     - name: my-special-secret
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.imagePullSecrets
 | |
|       value:
 | |
|       - name: my-pull-secret
 | |
|       - name: my-special-secret
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test nodeSelector
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.nodeSelector:
 | |
|       foo: bar
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.nodeSelector
 | |
|       value:
 | |
|         foo: bar
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test priorityClassName
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.priorityClassName: my-priority
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.priorityClassName
 | |
|       value: my-priority
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test restartPolicy
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.restartPolicy: Always
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.restartPolicy
 | |
|       value: Always
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test terminationGracePeriodSeconds
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.terminationGracePeriodSeconds: 120
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.terminationGracePeriodSeconds
 | |
|       value: 120
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test tolerations
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.tolerations:
 | |
|     - key: database/type
 | |
|       operator: Equal
 | |
|       value: postgres
 | |
|       effect: NoSchedule
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.tolerations
 | |
|       value:
 | |
|       - key: database/type
 | |
|         operator: Equal
 | |
|         value: postgres
 | |
|         effect: NoSchedule
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test topologySpreadConstraints
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.topologySpreadConstraints:
 | |
|     - topologyKey: kubernetes.io/hostname
 | |
|       whenUnsatisfiable: DoNotSchedule
 | |
|       labelSelector:
 | |
|         matchLabels:
 | |
|           app.kubernetes.io/instance: prometheus-postgres-exporter
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.topologySpreadConstraints
 | |
|       value:
 | |
|       - topologyKey: kubernetes.io/hostname
 | |
|         whenUnsatisfiable: DoNotSchedule
 | |
|         labelSelector:
 | |
|           matchLabels:
 | |
|             app.kubernetes.io/instance: prometheus-postgres-exporter
 | |
|     template: templates/deployment.yaml
 | |
| 
 | |
| - it: Test additional volumeMounts and volumes
 | |
|   set:
 | |
|     # Ensure that the secrets and config maps are well configured.
 | |
|     config.database.secret.databaseUsername: "postgres"
 | |
|     config.database.secret.databasePassword: "postgres"
 | |
|     config.database.secret.databaseConnectionUrl: "localhost:5432/postgres?sslmode=disable"
 | |
| 
 | |
|     # Normal test values
 | |
|     deployment.postgresExporter.volumeMounts:
 | |
|     - name: data
 | |
|       mountPath: /usr/lib/prometheus-postgres-exporter/data
 | |
|     deployment.volumes:
 | |
|     - name: data
 | |
|       hostPath:
 | |
|         path: /usr/lib/prometheus-postgres-exporter/data
 | |
|   asserts:
 | |
|   - equal:
 | |
|       path: spec.template.spec.containers[0].volumeMounts
 | |
|       value:
 | |
|       - name: data
 | |
|         mountPath: /usr/lib/prometheus-postgres-exporter/data
 | |
|       - name: config-d
 | |
|         mountPath: /etc/prometheus-postgres-exporter/config.d
 | |
|     template: templates/deployment.yaml
 | |
|   - equal:
 | |
|       path: spec.template.spec.volumes
 | |
|       value:
 | |
|       - name: data
 | |
|         hostPath:
 | |
|           path: /usr/lib/prometheus-postgres-exporter/data
 | |
|       - name: config-d
 | |
|         projected:
 | |
|           defaultMode: 444
 | |
|           sources:
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-exporter-config
 | |
|           - secret:
 | |
|               name: prometheus-postgres-exporter-unittest-web-config
 | |
|     template: templates/deployment.yaml |