openbao-helm/test/unit/injector-psp-role.bats
Christopher Swenson 710915952e
VAULT-571 Matching documented behavior and consul (#703)
VAULT-571 Matching documented behavior and consul

Consul's helm template defaults most of the enabled to the special value
`"-"`, which means to inherit from global. This is what is implied
should happen in Vault as well according to the documentation for the
helm chart:

> [global.enabled] The master enabled/disabled configuration. If this is
> true, most components will be installed by default. If this is false,
> no components will be installed by default and manually opting-in is
> required, such as by setting server.enabled to true.

(https://www.vaultproject.io/docs/platform/k8s/helm/configuration#enabled)

We also simplified the chart logic using a few template helpers.

Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
2022-03-21 09:50:23 -07:00

35 lines
1.1 KiB
Bash

#!/usr/bin/env bats
load _helpers
@test "injector/PodSecurityPolicy-Role: PodSecurityPolicy-Role not enabled by default" {
cd `chart_dir`
local actual=$( (helm template \
--show-only templates/injector-psp-role.yaml \
. || echo "---" ) | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "injector/PodSecurityPolicy-Role: enable with injector.enabled and global.psp.enable" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-psp-role.yaml \
--set 'injector.enabled=true' \
--set 'global.psp.enable=true' \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
@test "injector/PodSecurityPolicy-Role: ignore global.enabled" {
cd `chart_dir`
local actual=$( (helm template \
--show-only templates/injector-psp-role.yaml \
--set 'global.enabled=false' \
--set 'injector.enabled=true' \
--set 'global.psp.enable=true' \
. || echo "---") | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}