mirror of
https://github.com/bvanroll/cicdTest.git
synced 2025-08-29 12:02:47 +00:00
69 lines
2.4 KiB
Bash
69 lines
2.4 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load _helpers
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: disabled by default" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: disabled with server=false, ent secret defined" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
--set 'server.enabled=false' \
|
|
--set 'server.enterpriseLicense.secretName=foo' \
|
|
--set 'server.enterpriseLicense.secretKey=bar' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: disabled when ent secretName missing" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
--set 'server.enterpriseLicense.secretKey=bar' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: disabled when ent secretKey missing" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
--set 'server.enterpriseLicense.secretName=foo' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: disabled when enablePodSecurityPolicies=false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
--set 'server.enterpriseLicense.secretName=foo' \
|
|
--set 'server.enterpriseLicense.secretKey=bar' \
|
|
--set 'global.enablePodSecurityPolicies=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "enterpriseLicense/PodSecurityPolicy: enabled when ent license defined and enablePodSecurityPolicies=true" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/enterprise-license-podsecuritypolicy.yaml \
|
|
--set 'server.enterpriseLicense.secretName=foo' \
|
|
--set 'server.enterpriseLicense.secretKey=bar' \
|
|
--set 'global.enablePodSecurityPolicies=true' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
}
|