Files
chart/library/common-test/tests/deployment/spec_test.yaml

137 lines
3.2 KiB
YAML

suite: deployment spec test
templates:
- common.yaml
tests:
- it: should pass with workload enabled
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
podSpec: {}
asserts:
- documentIndex: &deploymentDoc 0
isKind:
of: Deployment
- documentIndex: *deploymentDoc
isAPIVersion:
of: apps/v1
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 1
revisionHistoryLimit: 3
strategy:
type: Recreate
- it: should apply spec correctly
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
replicas: 2
revisionHistoryLimit: 4
strategy: RollingUpdate
rollingUpdate:
maxSurge: 5
maxUnavailable: 5
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 2
revisionHistoryLimit: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 5
maxUnavailable: 5
- it: should apply maxSurge with 0
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
strategy: RollingUpdate
rollingUpdate:
maxSurge: 0
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
- it: should apply maxUnavailable with 0
set:
workload:
workload-name:
enabled: true
primary: true
type: Deployment
strategy: RollingUpdate
rollingUpdate:
maxUnavailable: 0
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
- it: should set replicas to 0 on ixChartContext - isStopped (true)
set:
global:
ixChartContext:
storageClassName: some-storage-class
isStopped: true
workload:
workload-name:
enabled: true
primary: true
type: Deployment
replicas: 2
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 0
- it: should not set replicas to 0 on ixChartContext - isStopped (false)
set:
global:
ixChartContext:
storageClassName: some-storage-class
isStopped: false
workload:
workload-name:
enabled: true
primary: true
type: Deployment
replicas: 2
podSpec: {}
asserts:
- documentIndex: *deploymentDoc
isSubset:
path: spec
content:
replicas: 2