chart:
  appVersion: 0.1.0
  version: 0.1.0
suite: Secret database template (basic)
release:
  name: prometheus-fail2ban-exporter-unittest
  namespace: testing
templates:
- templates/prometheus-fail2ban-exporter/secretWebConfig.yaml
tests:
- it: Rendering default secret.
  asserts:
  - hasDocuments:
      count: 1
  - containsDocument:
      apiVersion: v1
      kind: Secret
      name: prometheus-fail2ban-exporter-unittest-web-config
      namespace: testing
  - notExists:
      path: metadata.annotations
  - equal:
      path: metadata.labels
      value:
        app.kubernetes.io/instance: prometheus-fail2ban-exporter-unittest
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: prometheus-fail2ban-exporter
        app.kubernetes.io/version: 0.1.0
        helm.sh/chart: prometheus-fail2ban-exporter-0.1.0
  - equal:
      path: stringData["webConfig.yaml"]
      value: |
        {}

- it: Rendering custom webconfig.
  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:
  - 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