Skip to content

Commit

Permalink
Add test coverage for primary-datacenter flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Sep 21, 2022
1 parent e84d0f7 commit 7895594
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions charts/consul/test/unit/api-gateway-controller-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,32 @@ load _helpers
[ "${actual}" = "true" ]
}

@test "apiGateway/Deployment: primary-datacenter flag provided when federation enabled in non-primary datacenter" {
cd `chart_dir`
local object=$(helm template \
-s templates/api-gateway-controller-deployment.yaml \
--set 'apiGateway.enabled=true' \
--set 'apiGateway.image=foo' \
--set 'meshGateway.enabled=true' \
--set 'connectInject.enabled=true' \
--set 'global.tls.enabled=true' \
--set 'global.tls.enableAutoEncrypt=true' \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.datacenter=dc2' \
--set 'global.federation.enabled=true' \
--set 'global.federation.primaryDatacenter=dc1' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[] | select(.name == "api-gateway-controller")' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.command | any(contains("consul-api-gateway server"))' | tee /dev/stderr)
[ "${actual}" = "true" ]

local actual=$(echo $object |
yq -r '.command | any(contains("-primary-datacenter=dc1"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "apiGateway/Deployment: init container is created when global.acls.manageSystemACLs=true and has correct command when federation enabled in non-primary datacenter" {
cd `chart_dir`
local object=$(helm template \
Expand Down

0 comments on commit 7895594

Please sign in to comment.