suite: config template | metrics section (metrics token)
release:
  name: gitea-unittests
  namespace: testing
tests:
  - it: metrics token is set
    template: templates/gitea/config.yaml
    set:
      gitea:
        metrics:
          enabled: true
          token: "somepassword"
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.metrics
          value: |-
            ENABLED=true
            TOKEN=somepassword
  - it: metrics token is empty
    template: templates/gitea/config.yaml
    set:
      gitea:
        metrics:
          enabled: true
          token: ""
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.metrics
          value: |-
            ENABLED=true
  - it: metrics token is nil
    template: templates/gitea/config.yaml
    set:
      gitea:
        metrics:
          enabled: true
          token:
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.metrics
          value: |-
            ENABLED=true
  - it: does not configures a token if metrics are disabled
    template: templates/gitea/config.yaml
    set:
      gitea:
        metrics:
          enabled: false
          token: "somepassword"
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.metrics
          value: |-
            ENABLED=false
