suite: config template | queue config
release:
  name: gitea-unittests
  namespace: testing
tests:
  - it: "queue is configured correctly for valkey-cluster"
    template: templates/gitea/config.yaml
    set:
      valkey-cluster:
        enabled: true
      valkey:
        enabled: false
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.queue
          value: |-
            CONN_STR=redis+cluster://:@gitea-unittests-valkey-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
            TYPE=redis

  - it: "queue is configured correctly for valkey"
    template: templates/gitea/config.yaml
    set:
      valkey-cluster:
        enabled: false
      valkey:
        enabled: true
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.queue
          value: |-
            CONN_STR=redis://:changeme@gitea-unittests-valkey-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
            TYPE=redis

  - it: "queue is configured correctly for 'levelDB' when valkey (and valkey-cluster) is disabled"
    template: templates/gitea/config.yaml
    set:
      valkey-cluster:
        enabled: false
      valkey:
        enabled: false
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.queue
          value: |-
            CONN_STR=
            TYPE=level

  - it: "queue can be customized when valkey (and valkey-cluster) are disabled"
    template: templates/gitea/config.yaml
    set:
      valkey-cluster:
        enabled: false
      valkey:
        enabled: false
      gitea.config.queue.TYPE: custom-type
      gitea.config.queue.CONN_STR: custom-connection-string
    asserts:
      - documentIndex: 0
        equal:
          path: stringData.queue
          value: |-
            CONN_STR=custom-connection-string
            TYPE=custom-type
