Implement injector HA statefulset topology UTs

This commit is contained in:
Eric Miller 2021-11-22 15:24:38 -06:00
parent 567a4386a5
commit 102c29955b
3 changed files with 28 additions and 2 deletions

View file

@ -458,7 +458,7 @@ load _helpers
@test "injector/deployment: topologySpreadConstraints is null by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-deployment.yaml \
--show-only templates/injector-deployment.yaml \
. | tee /dev/stderr |
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
}

View file

@ -540,6 +540,32 @@ load _helpers
[ "${actual}" = "1" ]
}
#--------------------------------------------------------------------
# topologySpreadConstraints
@test "server/ha-StatefulSet: topologySpreadConstraints is null by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.ha.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
}
@test "server/ha-StatefulSet: topologySpreadConstraints can be set as YAML" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.ha.enabled=true' \
--set "server.topologySpreadConstraints[0].foo=bar,server.topologySpreadConstraints[1].baz=qux" \
. | tee /dev/stderr |
yq '.spec.template.spec.topologySpreadConstraints == [{"foo": "bar"}, {"baz": "qux"}]' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
#--------------------------------------------------------------------
# tolerations
@test "server/ha-StatefulSet: tolerations not set by default" {
cd `chart_dir`
local actual=$(helm template \

View file

@ -790,7 +790,7 @@ load _helpers
@test "server/standalone-StatefulSet: topologySpreadConstraints is null by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--show-only templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
}