github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/rancher-backup/tests/deployment_test.yaml (about)

     1  suite: Test Deployment
     2  templates:
     3  - deployment.yaml
     4  - s3-secret.yaml
     5  - pvc.yaml
     6  - _helpers.tpl
     7  tests:
     8  - it: should set name
     9    template: deployment.yaml
    10    asserts:
    11    - equal:
    12        path: metadata.name
    13        value: "rancher-backup"
    14  - it: should set namespace
    15    template: deployment.yaml
    16    asserts:
    17    - equal:
    18        path: metadata.namespace
    19        value: "NAMESPACE"
    20  - it: should set priorityClassName
    21    set:
    22      priorityClassName: "testClass"
    23    template: deployment.yaml
    24    asserts:
    25    - equal:
    26        path: spec.template.spec.priorityClassName
    27        value: "testClass"
    28  - it: should set default imagePullPolicy
    29    template: deployment.yaml
    30    asserts:
    31    - equal:
    32        path: spec.template.spec.containers[0].imagePullPolicy
    33        value: "Always"
    34  - it: should set imagePullPolicy
    35    set:
    36      imagePullPolicy: "IfNotPresent"
    37    template: deployment.yaml
    38    asserts:
    39    - equal:
    40        path: spec.template.spec.containers[0].imagePullPolicy
    41        value: "IfNotPresent"
    42  - it: should set debug loglevel
    43    set:
    44      debug: true
    45    template: deployment.yaml
    46    asserts:
    47    - contains:
    48        path: spec.template.spec.containers[0].args
    49        content: "--debug"
    50  - it: should set trace loglevel
    51    set:
    52      trace: true
    53    template: deployment.yaml
    54    asserts:
    55    - contains:
    56        path: spec.template.spec.containers[0].args
    57        content: "--trace"
    58  - it: should set proxy environment variables
    59    set:
    60      proxy: "https://127.0.0.1:3128"
    61    template: deployment.yaml
    62    asserts:
    63    - contains:
    64        path: spec.template.spec.containers[0].env
    65        content:
    66          name: HTTP_PROXY
    67          value: "https://127.0.0.1:3128"
    68    - contains:
    69        path: spec.template.spec.containers[0].env
    70        content:
    71          name: HTTPS_PROXY
    72          value: "https://127.0.0.1:3128"
    73    - contains:
    74        path: spec.template.spec.containers[0].env
    75        content:
    76          name: NO_PROXY
    77          value: "127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local"
    78  - it: should set proxy environment variables with modified noproxy
    79    set:
    80      proxy: "https://127.0.0.1:3128"
    81      noProxy: "192.168.0.0/24"
    82    template: deployment.yaml
    83    asserts:
    84    - contains:
    85        path: spec.template.spec.containers[0].env
    86        content:
    87          name: NO_PROXY
    88          value: "192.168.0.0/24"
    89  - it: should set persistence variables
    90    set:
    91      persistence.enabled: true
    92    template: deployment.yaml
    93    asserts:
    94    - contains:
    95        path: spec.template.spec.containers[0].env
    96        content:
    97          name: DEFAULT_PERSISTENCE_ENABLED
    98          value: "persistence-enabled"
    99    - contains:
   100        path: spec.template.spec.containers[0].volumeMounts
   101        content:
   102          mountPath: "/var/lib/backups"
   103          name: "pv-storage"
   104    - equal:
   105        path: spec.template.spec.volumes[0].name
   106        value: "pv-storage"
   107    - equal:
   108        path: spec.template.spec.volumes[0].persistentVolumeClaim
   109        value:
   110          claimName: RELEASE-NAME-0
   111  - it: should set private registry
   112    template: deployment.yaml
   113    set:
   114      global.cattle.systemDefaultRegistry: "my.registry.local:3000"
   115    asserts:
   116    - matchRegex:
   117        path: spec.template.spec.containers[0].image
   118        pattern: ^my.registry.local:3000/rancher/backup-restore-operator:.*$
   119  - it: should set nodeselector
   120    template: deployment.yaml
   121    asserts:
   122    - equal:
   123        path: spec.template.spec.nodeSelector
   124        value:
   125          kubernetes.io/os: linux
   126  - it: should not set default affinity
   127    template: deployment.yaml
   128    asserts:
   129    - isNull:
   130        path: spec.template.spec.affinity
   131  - it: should set custom affinity
   132    template: deployment.yaml
   133    set:
   134      affinity:
   135        nodeAffinity:
   136          requiredDuringSchedulingIgnoredDuringExecution:
   137            nodeSelectorTerms:
   138            - matchExpressions:
   139              - key: disktype
   140                operator: In
   141                values:
   142                - ssd  
   143    asserts:
   144    - equal:
   145        path: spec.template.spec.affinity
   146        value:
   147          nodeAffinity:
   148            requiredDuringSchedulingIgnoredDuringExecution:
   149              nodeSelectorTerms:
   150              - matchExpressions:
   151                - key: disktype
   152                  operator: In
   153                  values:
   154                  - ssd  
   155  - it: should set tolerations
   156    template: deployment.yaml
   157    asserts:
   158    - equal:
   159        path: spec.template.spec.tolerations[0]
   160        value:
   161          key: "cattle.io/os"
   162          value: "linux"
   163          effect: "NoSchedule"
   164          operator: "Equal"
   165  - it: should set custom tolerations
   166    template: deployment.yaml
   167    set:
   168      tolerations:
   169      - key: "example-key"
   170        operator: "Exists"
   171        effect: "NoSchedule"
   172    asserts:
   173    - equal:
   174        path: spec.template.spec.tolerations[0]
   175        value:
   176          key: "cattle.io/os"
   177          value: "linux"
   178          effect: "NoSchedule"
   179          operator: "Equal"
   180    - equal:
   181        path: spec.template.spec.tolerations[1]
   182        value:
   183          key: "example-key"
   184          operator: "Exists"
   185          effect: "NoSchedule"