2018-09-03 16:05:59 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load _helpers
|
|
|
|
|
|
|
|
@test "server/StatefulSet: enabled by default" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "true" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/StatefulSet: enable with global.enabled false" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'global.enabled=false' \
|
|
|
|
--set 'server.enabled=true' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "true" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/StatefulSet: disable with server.enabled" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'server.enabled=false' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "false" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/StatefulSet: disable with global.enabled" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'global.enabled=false' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "false" ]
|
|
|
|
}
|
|
|
|
|
2018-09-05 14:45:54 +00:00
|
|
|
@test "server/StatefulSet: image defaults to global.image" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'global.image=foo' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "foo" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/StatefulSet: image can be overridden with server.image" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'global.image=foo' \
|
|
|
|
--set 'server.image=bar' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "bar" ]
|
|
|
|
}
|
|
|
|
|
2018-09-03 16:05:59 +00:00
|
|
|
@test "server/StatefulSet: no updateStrategy when not updating" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq -r '.spec.updateStrategy' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "null" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/StatefulSet: updateStrategy during update" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'server.updatePartition=2' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq -r '.spec.updateStrategy.type' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "RollingUpdate" ]
|
|
|
|
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-statefulset.yaml \
|
|
|
|
--set 'server.updatePartition=2' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq -r '.spec.updateStrategy.rollingUpdate.partition' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "2" ]
|
|
|
|
}
|