123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- suite: pod restart policy test
- templates:
- - common.yaml
- tests:
- - it: should pass with restartPolicy empty
- set:
- podOptions:
- restartPolicy: ""
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec: {}
- asserts:
- - documentIndex: &deploymentDoc 0
- isKind:
- of: Deployment
- - documentIndex: *deploymentDoc
- equal:
- path: spec.template.spec.restartPolicy
- value: Always
- - it: should pass with restartPolicy set from "global"
- set:
- podOptions:
- restartPolicy: Always
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec: {}
- asserts:
- - documentIndex: *deploymentDoc
- equal:
- path: spec.template.spec.restartPolicy
- value: Always
- - it: should pass with restartPolicy set from "pod"
- set:
- podOptions:
- restartPolicy: Never
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec:
- restartPolicy: Always
- asserts:
- - documentIndex: *deploymentDoc
- equal:
- path: spec.template.spec.restartPolicy
- value: Always
- - it: should pass with restartPolicy set from "pod" on Jobs
- set:
- podOptions:
- restartPolicy: Never
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Job
- podSpec:
- restartPolicy: OnFailure
- asserts:
- - documentIndex: &jobDoc 0
- isKind:
- of: Job
- - documentIndex: *jobDoc
- equal:
- path: spec.template.spec.restartPolicy
- value: OnFailure
- - it: should pass with restartPolicy set from "pod" on Jobs from tpl
- set:
- policy: OnFailure
- podOptions:
- restartPolicy: Never
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Job
- podSpec:
- restartPolicy: "{{ .Values.policy }}"
- asserts:
- - documentIndex: *jobDoc
- equal:
- path: spec.template.spec.restartPolicy
- value: OnFailure
- # Failures
- - it: should fail with restartPolicy to Never on Deployment
- set:
- podOptions:
- restartPolicy: Never
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec: {}
- asserts:
- - failedTemplate:
- errorMessage: Expected <restartPolicy to be [Always] for [Deployment] but got [Never]
- - it: should fail with restartPolicy to invalid on global
- set:
- podOptions:
- restartPolicy: invalid
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec: {}
- asserts:
- - failedTemplate:
- errorMessage: Expected <restartPolicy to be one of [Never, Always, OnFailure] but got [invalid]
- - it: should fail with restartPolicy to invalid-policy on pod
- set:
- podOptions:
- restartPolicy: invalid
- workload:
- workload-name1:
- enabled: true
- primary: true
- type: Deployment
- podSpec:
- restartPolicy: invalid-policy
- asserts:
- - failedTemplate:
- errorMessage: Expected <restartPolicy to be one of [Never, Always, OnFailure] but got [invalid-policy]
|