Files
chart/library/common-test/tests/deployment/controller_test.yaml
2022-11-22 18:28:26 +02:00

81 lines
2.0 KiB
YAML

suite: deployment controller test
templates:
- common.yaml
tests:
- it: should pass with default values
documentIndex: &deploymentDoc 0
asserts:
- isKind:
of: Deployment
- equal:
path: apiVersion
value: apps/v1
- equal:
path: spec.revisionHistoryLimit
value: 3
- equal:
path: spec.replicas
value: 1
- equal:
path: spec.strategy.type
value: Recreate
- isNull:
path: spec.strategy.rollingUpdate
- it: should pass with controller disabled
documentIndex: *deploymentDoc
set:
controller:
enabled: false
asserts:
- hasDocuments:
count: 0
- it: should pass with controller strategy changed and rollingUpdate strategies set
documentIndex: *deploymentDoc
set:
controller:
strategy: RollingUpdate
rollingUpdate:
unavailable: 2
surge: 3
asserts:
- equal:
path: spec.strategy.type
value: RollingUpdate
- equal:
path: spec.strategy.rollingUpdate
value:
maxUnavailable: 2
maxSurge: 3
- it: should pass with controller strategy changed
documentIndex: *deploymentDoc
set:
controller:
strategy: RollingUpdate
asserts:
- equal:
path: spec.strategy.type
value: RollingUpdate
- isNull:
path: spec.strategy.rollingUpdate
- it: should fail with wrong controller
documentIndex: *deploymentDoc
set:
controller:
type: not_valid_controller
asserts:
- failedTemplate:
errorMessage: Not a valid controller.type (not_valid_controller)
- it: should fail with wrong strategy
documentIndex: *deploymentDoc
set:
controller:
strategy: not_valid_strategy
asserts:
- failedTemplate:
errorMessage: Not a valid strategy type for Deployment (not_valid_strategy)