Skip to content

Commit

Permalink
Fix injector unit test failing (#496)
Browse files Browse the repository at this point in the history
* Fix injector unit test failing

* Add null check

* Add default if unset for CI
  • Loading branch information
jasonodonnell authored Apr 14, 2021
1 parent f2e3d57 commit 5f2e1d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/unit/injector-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ load _helpers
yq -r 'map(select(.name=="AGENT_INJECT_TLS_AUTO")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "RELEASE-NAME-vault-agent-injector-cfg" ]

# helm template does uses current context namespace and ignores namespace flags, so
# discover the targeted namespace so we can check the rendered value correctly.
local namespace=$(kubectl config view --minify --output 'jsonpath={..namespace}')

local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_TLS_AUTO_HOSTS")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "RELEASE-NAME-vault-agent-injector-svc,RELEASE-NAME-vault-agent-injector-svc.default,RELEASE-NAME-vault-agent-injector-svc.default.svc" ]
[ "${value}" = "RELEASE-NAME-vault-agent-injector-svc,RELEASE-NAME-vault-agent-injector-svc.${namespace:-default},RELEASE-NAME-vault-agent-injector-svc.${namespace:-default}.svc" ]
}

@test "injector/deployment: with externalVaultAddr" {
Expand Down

0 comments on commit 5f2e1d4

Please sign in to comment.