suite: workload name test
templates:
  - common.yaml
tests:
  - it: should generate correct workload name
    set:
      workload:
        workload-name:
          enabled: true
          primary: true
          type: Deployment
          podSpec: {}
        cronjob-workload-name:
          enabled: true
          primary: false
          type: CronJob
          schedule: "*/1 * * * *"
          podSpec:
            restartPolicy: Never
        job-workload-name:
          enabled: true
          primary: false
          type: Job
          podSpec:
            restartPolicy: Never
    asserts:
      - documentIndex: &cronJobDoc 0
        isKind:
          of: CronJob
      - documentIndex: *cronJobDoc
        isAPIVersion:
          of: batch/v1
      - documentIndex: *cronJobDoc
        equal:
          path: metadata.name
          value: release-name-common-test-cronjob-workload-name
      - documentIndex: &jobDoc 1
        isKind:
          of: Job
      - documentIndex: *jobDoc
        isAPIVersion:
          of: batch/v1
      - documentIndex: *jobDoc
        equal:
          path: metadata.name
          value: release-name-common-test-job-workload-name
      - documentIndex: &deploymentDoc 2
        isKind:
          of: Deployment
      - documentIndex: *deploymentDoc
        isAPIVersion:
          of: apps/v1
      - documentIndex: *deploymentDoc
        equal:
          path: metadata.name
          value: release-name-common-test
