suite: Controller Admin Credentials
release:
  name: my-release
  namespace: my-namespace
templates:
  - secret.yaml
tests:
  - it: tests defaults
    asserts:
      - isKind:
          of: Secret
      - 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
      - equal:
          path: data.jenkins-admin-user
          value: YWRtaW4=
      - isNotNull:
          path: data.jenkins-admin-password
  - it: set admin password
    set:
      controller.adminPassword: secret
    asserts:
      - equal:
          path: data.jenkins-admin-user
          value: YWRtaW4=
      - equal:
          path: data.jenkins-admin-password
          value: c2VjcmV0
  - 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: disable
    set:
      controller:
        adminSecret: false
    asserts:
    - hasDocuments:
        count: 0
  - it: disable
    set:
      controller.admin.existingSecret: my-secret
    asserts:
    - hasDocuments:
        count: 0

