suite: Controller Service Account
release:
  name: my-release
  namespace: my-namespace
templates:
  - service-account.yaml
tests:
  - it: tests defaults
    asserts:
      - isKind:
          of: ServiceAccount
      - equal:
          path: apiVersion
          value: v1
      - equal:
          path: metadata.name
          value: my-release-jenkins
      - equal:
          path: metadata.namespace
          value: my-namespace
      - matchRegex:
          path: metadata.labels.helm\.sh/chart
          pattern: ^jenkins-
      - isNull:
          path: metadata.annotations

  - it: disable helm.sh label
    set:
      renderHelmLabels: false
    asserts:
      - equal:
          path: metadata.labels
          value:
            app.kubernetes.io/component: jenkins-controller
            app.kubernetes.io/instance: my-release
            app.kubernetes.io/managed-by: Helm
            app.kubernetes.io/name: jenkins

  - it: disabled
    set:
      serviceAccount:
        create: false
    asserts:
    - hasDocuments:
        count: 0

  - it: controller image pull secret
    set:
      renderHelmLabels: false
      serviceAccount:
        create: true
        imagePullSecretName: ips-name
    asserts:
      - equal:
          path: imagePullSecrets
          value:
            - name: ips-name

