Skip to content

Commit

Permalink
Add BATS for CONSUL_HTTP_SSL
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Eckert committed Nov 10, 2022
1 parent 57571e7 commit 630e1e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
{{- end }}
{{- end }}
- name: CONSUL_HTTP_SSL
value: {{ .Values.global.tls.enabled }}
value: "{{ .Values.global.tls.enabled }}"
{{- if and .Values.externalServers.enabled .Values.externalServers.tlsServerName }}
- name: CONSUL_TLS_SERVER_NAME
value: {{ .Values.externalServers.tlsServerName }}
Expand Down
27 changes: 27 additions & 0 deletions charts/consul/test/unit/api-gateway-controller-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,33 @@ load _helpers
[[ "$output" =~ "When either global.cloud.scadaAddress.secretName or global.cloud.scadaAddress.secretKey is defined, both must be set." ]]
}

#--------------------------------------------------------------------
# CONSUL_HTTP_SSL

@test "apiGateway/Deployment: CONSUL_HTTP_SSL set correctly when not using TLS." {
cd `chart_dir`
local actual=$(helm template \
-s templates/api-gateway-controller-deployment.yaml \
--set 'apiGateway.enabled=true' \
--set 'apiGateway.image=bar' \
--set 'global.tls.enabled=false' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].env[2].value' | tee /dev/stderr)
[ "${actual}" = "\"false\"" ]
}

@test "apiGateway/Deployment: CONSUL_HTTP_SSL set correctly when using TLS." {
cd `chart_dir`
local actual=$(helm template \
-s templates/api-gateway-controller-deployment.yaml \
--set 'apiGateway.enabled=true' \
--set 'apiGateway.image=bar' \
--set 'global.tls.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].env[3].value' | tee /dev/stderr)
[ "${actual}" = "\"true\"" ]
}

#--------------------------------------------------------------------
# CONSUL_HTTP_ADDR

Expand Down

0 comments on commit 630e1e1

Please sign in to comment.