openbao-helm/test/unit/csi-clusterrolebinding.bats
Arie Lev 7a71c0fec4
fix csi helm deployment (#486)
* fix serviceaccount and clusterrole name reference (full name)

* add server.enabled option, align with documentation

* add unit tests

* update server.enabled behaviour to explicit true and update tests
2021-04-06 14:56:11 +01:00

44 lines
No EOL
1.3 KiB
Bash

#!/usr/bin/env bats
load _helpers
@test "csi/ClusterRoleBinding: disabled by default" {
cd `chart_dir`
local actual=$( (helm template \
--show-only templates/csi-clusterrolebinding.yaml \
. || echo "---")| tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "csi/ClusterRoleBinding: enabled with csi.enabled" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-clusterrolebinding.yaml \
--set 'csi.enabled=true' \
. | tee /dev/stderr |
yq 'length > 0' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
# ClusterRoleBinding cluster role ref name
@test "csi/ClusterRoleBinding: cluster role ref name" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-clusterrolebinding.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq -r '.roleRef.name' | tee /dev/stderr)
[ "${actual}" = "RELEASE-NAME-vault-csi-provider-clusterrole" ]
}
# ClusterRoleBinding service account name
@test "csi/ClusterRoleBinding: service account name" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-clusterrolebinding.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq -r '.subjects[0].name' | tee /dev/stderr)
[ "${actual}" = "RELEASE-NAME-vault-csi-provider" ]
}