suite: ServiceAccount
templates:
  - serviceaccount.yaml
tests:
  - it: sets ServiceAccount labels when specified
    values:
      - ../.lint/extra-labels.yaml
    asserts:
      - equal:
          path: metadata.labels.app\.kubernetes\.io/name
          value: teleport-kube-agent
      - equal:
          path: metadata.labels.resource
          value: serviceaccount
      - matchSnapshot: {}

  - it: sets ServiceAccount annotations when specified
    values:
      - ../.lint/annotations.yaml
    asserts:
      - equal:
          path: metadata.annotations.kubernetes\.io/serviceaccount
          value: test-annotation
      - equal:
          path: metadata.annotations.kubernetes\.io/serviceaccount-different
          value: 5
      - matchSnapshot: {}
  - it: skips ServiceAccount creation
    set:
      serviceAccount.create: false
    asserts:
      - hasDocuments:
          count: 0