suite: test controller deployment
templates:
  - deployment.yaml
tests:
  - it: should match snapshot of default values
    asserts:
      - matchSnapshot: {}
  - it: should set imagePullPolicy to Always
    set:
      image.pullPolicy: Always
    asserts:
      - equal:
          path: spec.template.spec.containers[0].imagePullPolicy
          value: Always
  - it: should imagePullPolicy to be default value IfNotPresent
    asserts:
      - equal:
          path: spec.template.spec.containers[0].imagePullPolicy
          value: IfNotPresent
  - it: should override securityContext
    set:
      podSecurityContext:
        runAsUser: 2000
      securityContext:
        runAsUser: 3000
    asserts:
      - equal:
          path: spec.template.spec.securityContext
          value:
            runAsUser: 2000
      - equal:
          path: spec.template.spec.containers[0].securityContext
          value:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
                - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 3000
            seccompProfile:
              type: RuntimeDefault
  - it: should override hostNetwork
    set:
      hostNetwork: true
    asserts:
      - equal:
          path: spec.template.spec.hostNetwork
          value: true
  - it: should override metrics port
    set:
      metrics.listen.port: 8888
    asserts:
      - equal:
          path: spec.template.spec.containers[0].args[1]
          value: "--metrics-addr=:8888"
