Skip to content

Commit

Permalink
reformat some of the config tests so they run locally on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
tvoran committed Nov 13, 2024
1 parent fa03924 commit 3a23945
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions test/unit/server-configmap.bats
Original file line number Diff line number Diff line change
Expand Up @@ -136,32 +136,35 @@ load _helpers
--set 'server.standalone.config=\{\"hello\": \"world\"\}' \
. | tee /dev/stderr |
yq '.data')
[ "$(echo "${data}" | \
yq '(. | length) == 1')" = "true" ]
[ "$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"hello\":\"world\"}"')" = 'true' ]
local checkLength=$(echo "${data}" | yq '(. | length) == 1')
[ "${checkLength}" = "true" ]
local checkExtraConfig=$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"hello\":\"world\"}"')
[ "${checkExtraConfig}" = 'true' ]

data=$(helm template \
--show-only templates/server-config-configmap.yaml \
--set 'server.standalone.enabled=true' \
--set 'server.standalone.config=\{\"foo\": \"bar\"\}' \
. | tee /dev/stderr |
yq '.data' | tee /dev/stderr)
[ "$(echo "${data}" | \
yq '(. | length) == 1')" = "true" ]
[ "$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"foo\":\"bar\"}"')" = 'true' ]
checkLength=$(echo "${data}" | yq '(. | length) == 1')
[ "${checkLength}" = "true" ]
checkExtraConfig=$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"foo\":\"bar\"}"')
[ "${checkExtraConfig}" = 'true' ]

data=$(helm template \
--show-only templates/server-config-configmap.yaml \
--set 'server.standalone.enabled=true' \
--set 'server.standalone.config=\{\"disable_mlock\": false\,\"foo\":\"bar\"\}' \
. | tee /dev/stderr |
yq '.data' | tee /dev/stderr)
[ "$(echo "${data}" | \
yq '(. | length) == 1')" = "true" ]
[ "$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":false,\"foo\":\"bar\"}"')" = 'true' ]
checkLength=$(echo "${data}" | yq '(. | length) == 1')
[ "${checkLength}" = "true" ]
checkExtraConfig=$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":false,\"foo\":\"bar\"}"')
[ "${checkExtraConfig}" = 'true' ]
}

@test "server/ConfigMap: standalone extraConfig is set as not JSON" {
Expand Down Expand Up @@ -202,21 +205,23 @@ load _helpers
--set 'server.ha.config=\{\"hello\": \"ha-world\"\}' \
. | tee /dev/stderr |
yq '.data' | tee /dev/stderr)
[ "$(echo "${data}" | \
yq '(. | length) == 1')" = "true" ]
[ "$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"hello\":\"ha-world\"}"')" = 'true' ]
local checkLength=$(echo "${data}" | yq '(. | length) == 1')
[ "${checkLength}" = "true" ]
local checkExtraConfig=$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":true,\"hello\":\"ha-world\"}"')
[ "$checkExtraConfig" = 'true' ]

data=$(helm template \
--show-only templates/server-config-configmap.yaml \
--set 'server.ha.enabled=true' \
--set 'server.ha.config=\{\"foo\": \"bar\"\,\"disable_mlock\":false\}' \
. | tee /dev/stderr |
yq '.data' | tee /dev/stderr)
[ "$(echo "${data}" | \
yq '(. | length) == 1')" = "true" ]
[ "$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":false,\"foo\":\"bar\"}"')" = 'true' ]
checkLength=$(echo "${data}" | yq '(. | length) == 1')
[ "$checkLength" = "true" ]
checkExtraConfig=$(echo "${data}" | \
yq '."extraconfig-from-values.hcl" == "{\"disable_mlock\":false,\"foo\":\"bar\"}"')
[ "${checkExtraConfig}" = 'true' ]
}

@test "server/ConfigMap: disabled by injector.externalVaultAddr" {
Expand Down

0 comments on commit 3a23945

Please sign in to comment.