
* Add vault agent injector * Fix bug with agent image env * Fix terraform GKE code * Cleanup label * Improve test reliablity * Lower sleep times in tests * Standardize image values * Update values * Update vault tag
77 lines
2.4 KiB
Bash
Executable file
77 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/env bats
|
|
|
|
load _helpers
|
|
|
|
@test "injector/MutatingWebhookConfiguration: enabled by default" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "true" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: disable with global.enabled false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'global.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: disable with injector.enabled false" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'injector.enabled=false' \
|
|
. | tee /dev/stderr |
|
|
yq 'length > 0' | tee /dev/stderr)
|
|
[ "${actual}" = "false" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: namespace is set" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'injector.enabled=true' \
|
|
--namespace foo \
|
|
. | tee /dev/stderr |
|
|
yq '.webhooks[0].clientConfig.service.namespace' | tee /dev/stderr)
|
|
[ "${actual}" = "\"foo\"" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: caBundle is empty" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'injector.enabled=true' \
|
|
--namespace foo \
|
|
. | tee /dev/stderr |
|
|
yq '.webhooks[0].clientConfig.caBundle' | tee /dev/stderr)
|
|
[ "${actual}" = "null" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: namespaceSelector empty by default" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'injector.enabled=true' \
|
|
--namespace foo \
|
|
. | tee /dev/stderr |
|
|
yq '.webhooks[0].namespaceSelector' | tee /dev/stderr)
|
|
[ "${actual}" = "null" ]
|
|
}
|
|
|
|
@test "injector/MutatingWebhookConfiguration: can set namespaceSelector" {
|
|
cd `chart_dir`
|
|
local actual=$(helm template \
|
|
-x templates/injector-mutating-webhook.yaml \
|
|
--set 'injector.enabled=true' \
|
|
--set 'injector.namespaceSelector.matchLabels.injector=true' \
|
|
. | tee /dev/stderr |
|
|
yq '.webhooks[0].namespaceSelector.matchLabels.injector' | tee /dev/stderr)
|
|
|
|
[ "${actual}" = "true" ]
|
|
}
|