suite: cnpg backup name test
templates:
  - common.yaml
release:
  name: test-release-name
  namespace: test-release-namespace
tests:
  - it: should generate correct name
    set:
      credentials:
        test:
          type: s3
          encrKey: some-encr-key
          accessKey: some-access-key
          secretKey: some-secret-key
          bucket: some-bucket
          url: http://some-url
      cnpg:
        my-pg:
          enabled: true
          user: test-user
          database: test-db
          password: test-password
          backups:
            enabled: true
            target: primary
            retentionPolicy: 10d
            credentials: test
            destinationPath: some-path
            manualBackups:
              - name: today
        my-pg2:
          enabled: true
          user: test-user
          database: test-db
          password: test-password
          backups:
            enabled: true
            target: primary
            retentionPolicy: 10d
            credentials: test
            destinationPath: some-path
            manualBackups:
              - name: other
    asserts:
      - documentIndex: &backupDoc 0
        isKind:
          of: Backup
      - documentIndex: *backupDoc
        isAPIVersion:
          of: postgresql.cnpg.io/v1
      - documentIndex: *backupDoc
        equal:
          path: metadata.name
          value: test-release-name-common-test-cnpg-my-pg-backup-today
      - documentIndex: &otherbackupDoc 2
        isKind:
          of: Backup
      - documentIndex: *otherbackupDoc
        isAPIVersion:
          of: postgresql.cnpg.io/v1
      - documentIndex: *otherbackupDoc
        equal:
          path: metadata.name
          value: test-release-name-common-test-cnpg-my-pg2-backup-other
