2019-08-08 18:14:58 +00:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load _helpers
|
|
|
|
|
2019-12-19 15:57:51 +00:00
|
|
|
@test "server/ClusterRoleBinding: enabled by default" {
|
2019-08-08 18:14:58 +00:00
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
|
|
|
--set 'server.dev.enabled=true' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "true" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
|
|
|
--set 'server.ha.enabled=true' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "true" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "true" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "server/ClusterRoleBinding: disable with global.enabled" {
|
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
|
|
|
--set 'global.enabled=false' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "false" ]
|
|
|
|
}
|
|
|
|
|
2019-12-19 15:57:51 +00:00
|
|
|
@test "server/ClusterRoleBinding: can disable with server.authDelegator" {
|
2019-08-08 18:14:58 +00:00
|
|
|
cd `chart_dir`
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
2019-12-19 15:57:51 +00:00
|
|
|
--set 'server.authDelegator.enabled=false' \
|
2019-08-08 18:14:58 +00:00
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "false" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
2019-12-19 15:57:51 +00:00
|
|
|
--set 'server.authDelegator.enabled=false' \
|
2019-08-08 18:14:58 +00:00
|
|
|
--set 'server.ha.enabled=true' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "false" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
|
|
|
|
local actual=$(helm template \
|
|
|
|
-x templates/server-clusterrolebinding.yaml \
|
2019-12-19 15:57:51 +00:00
|
|
|
--set 'server.authDelegator.enabled=false' \
|
2019-08-08 18:14:58 +00:00
|
|
|
--set 'server.dev.enabled=true' \
|
|
|
|
. | tee /dev/stderr |
|
|
|
|
yq 'length > 0' | tee /dev/stderr)
|
2019-12-19 15:57:51 +00:00
|
|
|
[ "${actual}" = "false" ]
|
2019-08-08 18:14:58 +00:00
|
|
|
}
|