suite: Metrics secret template (monitoring enabled)
release:
  name: gitea-unittests
  namespace: testing
templates:
  - templates/gitea/metrics-secret.yaml
tests:
  - it: renders nothing if monitoring enabled and gitea.metrics.token empty
    set:
      gitea.metrics.enabled: true
      gitea.metrics.serviceMonitor.enabled: true
      gitea.metrics.token: ""
    asserts:
      - hasDocuments:
          count: 0
  - it: renders Secret if monitoring enabled and gitea.metrics.token not empty
    set:
      gitea.metrics.enabled: true
      gitea.metrics.serviceMonitor.enabled: true
      gitea.metrics.token: "test-token"
    asserts:
      - hasDocuments:
          count: 1
      - documentIndex: 0
        containsDocument:
          kind: Secret
          apiVersion: v1
          name: gitea-unittests-metrics-secret
      - isNotNullOrEmpty:
          path: metadata.labels
      - equal:
          path: data.token
          value: "dGVzdC10b2tlbg=="
