suite: PersistentVolumeClaim tests
templates:
  - templates/pvc.yaml
tests:
  - it: should create PVC for SQLite with persistence enabled
    set:
      database.type: sqlite
      persistence.enabled: true
      persistence.size: 1Gi
    asserts:
      - hasDocuments:
          count: 1
      - isKind:
          of: PersistentVolumeClaim
      - equal:
          path: metadata.name
          value: RELEASE-NAME-fuellhorn-data
      - equal:
          path: spec.resources.requests.storage
          value: 1Gi
      - equal:
          path: spec.accessModes[0]
          value: ReadWriteOnce

  - it: should not create PVC for PostgreSQL
    set:
      database.type: postgresql
      persistence.enabled: true
    asserts:
      - hasDocuments:
          count: 0

  - it: should not create PVC when persistence is disabled
    set:
      database.type: sqlite
      persistence.enabled: false
    asserts:
      - hasDocuments:
          count: 0

  - it: should set custom storage class when specified
    set:
      database.type: sqlite
      persistence.enabled: true
      persistence.storageClass: fast-storage
      persistence.size: 5Gi
    asserts:
      - equal:
          path: spec.storageClassName
          value: fast-storage
      - equal:
          path: spec.resources.requests.storage
          value: 5Gi

  - it: should not set storageClassName when not specified
    set:
      database.type: sqlite
      persistence.enabled: true
    asserts:
      - isNull:
          path: spec.storageClassName
