suite: actions template | config-scripts
release:
  name: gitea-unittests
  namespace: testing
templates:
  - templates/config-scripts.yaml
tests:
  - it: renders a ConfigMap when all criteria are met
    template: templates/config-scripts.yaml
    set:
      enabled: true
      provisioning:
        enabled: true
      persistence:
        enabled: true
        mount: true
    asserts:
      - hasDocuments:
          count: 1
      - containsDocument:
          kind: ConfigMap
          apiVersion: v1
          name: gitea-unittests-actions-scripts
      - isNotNullOrEmpty:
          path: data["token.sh"]
  - it: doesn't renders a ConfigMap by default
    template: templates/config-scripts.yaml
    asserts:
      - hasDocuments:
          count: 0
  - it: doesn't renders a ConfigMap with disabled actions but enabled provisioning
    template: templates/config-scripts.yaml
    asserts:
      - hasDocuments:
          count: 0
  - it: doesn't renders a ConfigMap with disabled actions but otherwise met criteria
    template: templates/config-scripts.yaml
    set:
      enabled: false
      provisioning:
        enabled: true
      persistence:
        enabled: true
        mount: true
    asserts:
      - hasDocuments:
          count: 0