From e868608063188f006d15ad4c9e5132f004533343 Mon Sep 17 00:00:00 2001 From: Ashwin Venkatesh Date: Tue, 19 Apr 2022 12:28:49 -0400 Subject: [PATCH 1/2] Update consul-helm-test with go 1.17 - Update the bats version in the Dockerfile. - Update the go.sum as they were missing dependencies. --- .circleci/config.yml | 16 ++++++++-------- .github/workflows/test.yml | 2 +- charts/consul/test/docker/Test.dockerfile | 6 ++++-- cli/go.sum | 1 + control-plane/go.sum | 2 ++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6a5c0a75a..e6ff26b6d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -483,7 +483,7 @@ jobs: unit-test-helm-templates: docker: - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - checkout @@ -562,7 +562,7 @@ jobs: ########################## cleanup-gcp-resources: docker: - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - run: name: cleanup leftover resources @@ -579,7 +579,7 @@ jobs: cleanup-azure-resources: docker: - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - run: name: cleanup leftover resources @@ -596,7 +596,7 @@ jobs: cleanup-eks-resources: docker: - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - checkout - run: @@ -621,7 +621,7 @@ jobs: - TEST_RESULTS: /tmp/test-results docker: # This image is built from test/docker/Test.dockerfile - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - run: @@ -687,7 +687,7 @@ jobs: - TEST_RESULTS: /tmp/test-results docker: # This image is built from test/docker/Test.dockerfile - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - checkout @@ -742,7 +742,7 @@ jobs: - TEST_RESULTS: /tmp/test-results docker: # This image is built from test/docker/Test.dockerfile - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - checkout @@ -804,7 +804,7 @@ jobs: parallelism: 1 docker: # This image is built from test/docker/Test.dockerfile - - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 steps: - checkout diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d58b35326b..1503d1c9c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,7 +74,7 @@ jobs: - unit-helm-gen runs-on: ubuntu-latest container: - image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.10.0 + image: docker.mirror.hashicorp.services/hashicorpdev/consul-helm-test:0.11.0 options: --user 1001 steps: - name: Checkout code diff --git a/charts/consul/test/docker/Test.dockerfile b/charts/consul/test/docker/Test.dockerfile index 48f0605024..ef6eb78c67 100644 --- a/charts/consul/test/docker/Test.dockerfile +++ b/charts/consul/test/docker/Test.dockerfile @@ -6,14 +6,16 @@ # a script to configure kubectl, potentially install Helm, and run the tests # manually. This image only has the dependencies pre-installed. -FROM circleci/golang:1.16 +FROM circleci/golang:1.17 # change the user to root so we can install stuff USER root -ENV BATS_VERSION "1.2.1" +ENV BATS_VERSION "1.6.0" ENV TERRAFORM_VERSION "0.13.5" +RUN apt-get update + # base packages RUN apt-get install -y \ openssl \ diff --git a/cli/go.sum b/cli/go.sum index 60485ead52..d6ada483c0 100644 --- a/cli/go.sum +++ b/cli/go.sum @@ -134,6 +134,7 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/control-plane/go.sum b/control-plane/go.sum index 1ce7635c04..2506e9e613 100644 --- a/control-plane/go.sum +++ b/control-plane/go.sum @@ -105,6 +105,7 @@ github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -996,6 +997,7 @@ k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8 k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= +k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= From 3459e92a14716545a77639007b5c324828e03c37 Mon Sep 17 00:00:00 2001 From: Ashwin Venkatesh Date: Tue, 19 Apr 2022 13:09:30 -0400 Subject: [PATCH 2/2] update bats tests for latest bats --- .../api-gateway-controller-deployment.bats | 4 ++-- charts/consul/test/unit/client-daemonset.bats | 16 +++++++------- charts/consul/test/unit/client-role.bats | 16 +++++++------- .../client-snapshot-agent-deployment.bats | 2 +- .../test/unit/connect-inject-deployment.bats | 10 ++++----- .../test/unit/controller-deployment.bats | 4 ++-- .../unit/create-federation-secret-job.bats | 4 ++-- .../unit/create-federation-secret-role.bats | 2 +- .../test/unit/enterprise-license-job.bats | 4 ++-- .../test/unit/enterprise-license-role.bats | 2 +- charts/consul/test/unit/helpers.bats | 8 +++---- .../unit/ingress-gateways-deployment.bats | 16 +++++++------- .../ingress-gateways-podsecuritypolicy.bats | 4 ++-- .../test/unit/ingress-gateways-role.bats | 6 ++--- .../unit/ingress-gateways-rolebinding.bats | 4 ++-- .../test/unit/ingress-gateways-service.bats | 6 ++--- .../unit/ingress-gateways-serviceaccount.bats | 4 ++-- .../unit/mesh-gateway-clusterrolebinding.bats | 2 +- .../test/unit/mesh-gateway-deployment.bats | 18 +++++++-------- .../unit/server-acl-init-cleanup-job.bats | 2 +- .../test/unit/server-config-configmap.bats | 4 ++-- charts/consul/test/unit/server-role.bats | 6 ++--- .../consul/test/unit/server-statefulset.bats | 22 +++++++++---------- .../test/unit/sync-catalog-deployment.bats | 10 ++++----- .../unit/terminating-gateways-deployment.bats | 12 +++++----- ...erminating-gateways-podsecuritypolicy.bats | 4 ++-- .../test/unit/terminating-gateways-role.bats | 6 ++--- .../terminating-gateways-rolebinding.bats | 4 ++-- .../terminating-gateways-serviceaccount.bats | 4 ++-- .../test/unit/tls-init-cleanup-role.bats | 2 +- charts/consul/test/unit/tls-init-job.bats | 12 +++++----- charts/consul/test/unit/tls-init-role.bats | 2 +- 32 files changed, 111 insertions(+), 111 deletions(-) diff --git a/charts/consul/test/unit/api-gateway-controller-deployment.bats b/charts/consul/test/unit/api-gateway-controller-deployment.bats index a80b997b61..e08b672eb5 100755 --- a/charts/consul/test/unit/api-gateway-controller-deployment.bats +++ b/charts/consul/test/unit/api-gateway-controller-deployment.bats @@ -93,7 +93,7 @@ load _helpers --set 'apiGateway.enabled=true' \ --set 'apiGateway.image=bar' \ . | tee /dev/stderr | - yq '.spec.template.spec.containers[0].command | join(" ") | contains("-sds-server-host RELEASE-NAME-consul-api-gateway-controller.default.svc")' | tee /dev/stderr) + yq '.spec.template.spec.containers[0].command | join(" ") | contains("-sds-server-host release-name-consul-api-gateway-controller.default.svc")' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -365,7 +365,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | diff --git a/charts/consul/test/unit/client-daemonset.bats b/charts/consul/test/unit/client-daemonset.bats index 6e4ff46214..c9d4a5fb10 100755 --- a/charts/consul/test/unit/client-daemonset.bats +++ b/charts/consul/test/unit/client-daemonset.bats @@ -551,7 +551,7 @@ load _helpers -s templates/client-daemonset.yaml \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = aa432a6e22a4c6c7c07f39896f893df1d638575222eea0245d33a5094914ab61 ] + [ "${actual}" = 3bd6198418457f5acc746c0d21fbb4afdf2b38e5bbcfef23fb3f97e2600fe964 ] } @test "client/DaemonSet: config-checksum annotation changes when extraConfig is provided" { @@ -561,7 +561,7 @@ load _helpers --set 'client.extraConfig="{\"hello\": \"world\"}"' \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = 50357c9dd53f1cb8e5b4c953f832269df82f4fea12cb63f1581890ac55d9ce58 ] + [ "${actual}" = 41535aa4cb7cffc4c70641efc882f5d6e3e87fce6e76d409409ff287cb4b23e8 ] } @test "client/DaemonSet: config-checksum annotation changes when connectInject.enabled=true" { @@ -571,7 +571,7 @@ load _helpers --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = 60a99c69e2b0fc842723ef1c5e34b60fbdf15460b70deb1831b692f14f74e972 ] + [ "${actual}" = bad77069ea6e4915272cf520faecb96333f6adef97c992e0aecc324381754eb2 ] } #-------------------------------------------------------------------- @@ -614,7 +614,7 @@ load _helpers -s templates/client-daemonset.yaml \ --set 'global.gossipEncryption.autoGenerate=true' \ . | tee /dev/stderr | - yq '.spec.template.spec.containers[] | select(.name=="consul") | .env[] | select(.name == "GOSSIP_KEY") | .valueFrom.secretKeyRef | [.name=="RELEASE-NAME-consul-gossip-encryption-key", .key="key"] | all' | tee /dev/stderr) + yq '.spec.template.spec.containers[] | select(.name=="consul") | .env[] | select(.name == "GOSSIP_KEY") | .valueFrom.secretKeyRef | [.name=="release-name-consul-gossip-encryption-key", .key="key"] | all' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -817,7 +817,7 @@ load _helpers local actual actual=$(echo $env | jq -r '. | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = "https://RELEASE-NAME-consul-server.default.svc:8501" ] + [ "${actual}" = "https://release-name-consul-server.default.svc:8501" ] } @test "client/DaemonSet: Adds consul envvars CONSUL_HTTP_ADDR on acl-init init container when ACLs are enabled and tls is not enabled" { @@ -830,7 +830,7 @@ load _helpers local actual actual=$(echo $env | jq -r '. | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = "http://RELEASE-NAME-consul-server.default.svc:8500" ] + [ "${actual}" = "http://release-name-consul-server.default.svc:8500" ] } @test "client/DaemonSet: Does not add consul envvars CONSUL_CACERT on acl-init init container when ACLs are enabled and tls is not enabled" { @@ -1136,7 +1136,7 @@ local actual=$(echo $object | [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("acl-auth-method=\"RELEASE-NAME-consul-k8s-component-auth-method\""))' | tee /dev/stderr) + yq -r '.command | any(contains("acl-auth-method=\"release-name-consul-k8s-component-auth-method\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -1180,7 +1180,7 @@ local actual=$(echo $object | [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("acl-auth-method=\"RELEASE-NAME-consul-k8s-component-auth-method\""))' | tee /dev/stderr) + yq -r '.command | any(contains("acl-auth-method=\"release-name-consul-k8s-component-auth-method\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | diff --git a/charts/consul/test/unit/client-role.bats b/charts/consul/test/unit/client-role.bats index 0ad5bf1a47..066e4ad98d 100644 --- a/charts/consul/test/unit/client-role.bats +++ b/charts/consul/test/unit/client-role.bats @@ -110,7 +110,7 @@ load _helpers --set 'global.openshift.enabled=true' \ . | tee /dev/stderr | yq -r '.rules[] | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-client" ] + [ "${actual}" = "release-name-consul-client" ] } @test "client/Role: allows securitycontextconstraints and acl secret access with global.openshift.enabled=true and global.acls.manageSystemACLs=true" { @@ -124,10 +124,10 @@ load _helpers yq -r '.rules[]' | tee /dev/stderr) local scc_resource=$(echo $rules | jq -r '. | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]') - [ "${scc_resource}" = "RELEASE-NAME-consul-client" ] + [ "${scc_resource}" = "release-name-consul-client" ] local secrets_resource=$(echo $rules | jq -r '. | select(.resources==["secrets"]) | .resourceNames[0]') - [ "${secrets_resource}" = "RELEASE-NAME-consul-client-acl-token" ] + [ "${secrets_resource}" = "release-name-consul-client-acl-token" ] } @test "client/Role: allows securitycontextconstraints and psp access with global.openshift.enabled=true and global.enablePodSecurityPolices=true" { @@ -141,10 +141,10 @@ load _helpers yq -r '.rules[]' | tee /dev/stderr) local scc_resource=$(echo $rules | jq -r '. | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]') - [ "${scc_resource}" = "RELEASE-NAME-consul-client" ] + [ "${scc_resource}" = "release-name-consul-client" ] local psp_resource=$(echo $rules | jq -r '. | select(.resources==["podsecuritypolicies"]) | .resourceNames[0]') - [ "${psp_resource}" = "RELEASE-NAME-consul-client" ] + [ "${psp_resource}" = "release-name-consul-client" ] } @test "client/Role: allows securitycontextconstraints, acl secret, and psp access when all global.openshift.enabled, global.enablePodSecurityPolices, and global.acls.manageSystemACLs are true " { @@ -159,11 +159,11 @@ load _helpers yq -r '.rules[]' | tee /dev/stderr) local scc_resource=$(echo $rules | jq -r '. | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]') - [ "${scc_resource}" = "RELEASE-NAME-consul-client" ] + [ "${scc_resource}" = "release-name-consul-client" ] local secrets_resource=$(echo $rules | jq -r '. | select(.resources==["secrets"]) | .resourceNames[0]') - [ "${secrets_resource}" = "RELEASE-NAME-consul-client-acl-token" ] + [ "${secrets_resource}" = "release-name-consul-client-acl-token" ] local psp_resource=$(echo $rules | jq -r '. | select(.resources==["podsecuritypolicies"]) | .resourceNames[0]') - [ "${psp_resource}" = "RELEASE-NAME-consul-client" ] + [ "${psp_resource}" = "release-name-consul-client" ] } diff --git a/charts/consul/test/unit/client-snapshot-agent-deployment.bats b/charts/consul/test/unit/client-snapshot-agent-deployment.bats index 7a3ed272ae..6c565138d1 100644 --- a/charts/consul/test/unit/client-snapshot-agent-deployment.bats +++ b/charts/consul/test/unit/client-snapshot-agent-deployment.bats @@ -278,7 +278,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | diff --git a/charts/consul/test/unit/connect-inject-deployment.bats b/charts/consul/test/unit/connect-inject-deployment.bats index d7719dc004..eb4f820025 100755 --- a/charts/consul/test/unit/connect-inject-deployment.bats +++ b/charts/consul/test/unit/connect-inject-deployment.bats @@ -492,7 +492,7 @@ EOF --set 'connectInject.enabled=true' \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq '.spec.template.spec.containers[0].command | any(contains("-acl-auth-method=\"RELEASE-NAME-consul-k8s-auth-method\""))' | tee /dev/stderr) + yq '.spec.template.spec.containers[0].command | any(contains("-acl-auth-method=\"release-name-consul-k8s-auth-method\""))' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -549,7 +549,7 @@ EOF -s templates/connect-inject-deployment.yaml \ --set 'connectInject.enabled=true' \ . | tee /dev/stderr | - yq -c -r '.spec.template.spec.containers[0].command | join(" ") | contains("-resource-prefix=RELEASE-NAME-consul")' | tee /dev/stderr) + yq -c -r '.spec.template.spec.containers[0].command | join(" ") | contains("-resource-prefix=release-name-consul")' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -1036,7 +1036,7 @@ EOF [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -1154,7 +1154,7 @@ EOF [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -1180,7 +1180,7 @@ EOF [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | diff --git a/charts/consul/test/unit/controller-deployment.bats b/charts/consul/test/unit/controller-deployment.bats index c9401c4d19..106b9d59df 100644 --- a/charts/consul/test/unit/controller-deployment.bats +++ b/charts/consul/test/unit/controller-deployment.bats @@ -155,7 +155,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -250,7 +250,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | diff --git a/charts/consul/test/unit/create-federation-secret-job.bats b/charts/consul/test/unit/create-federation-secret-job.bats index b1db5fe12c..09e823efe6 100644 --- a/charts/consul/test/unit/create-federation-secret-job.bats +++ b/charts/consul/test/unit/create-federation-secret-job.bats @@ -76,7 +76,7 @@ load _helpers local actual # test it uses the auto-generated ca secret - actual=$(echo $volumes | yq 'map(select(.name=="consul-ca-cert" and .secret.secretName=="RELEASE-NAME-consul-ca-cert")) | length > 0' | tee /dev/stderr) + actual=$(echo $volumes | yq 'map(select(.name=="consul-ca-cert" and .secret.secretName=="release-name-consul-ca-cert")) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] # test it uses the correct secret key for the auto-generated ca secret @@ -84,7 +84,7 @@ load _helpers [ "${actual}" = "true" ] # test it uses the auto-generated ca key secret - actual=$(echo $volumes | yq 'map(select(.name=="consul-ca-key" and .secret.secretName=="RELEASE-NAME-consul-ca-key")) | length > 0' | tee /dev/stderr) + actual=$(echo $volumes | yq 'map(select(.name=="consul-ca-key" and .secret.secretName=="release-name-consul-ca-key")) | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] # test it uses the correct secret key for the auto-generated ca key secret diff --git a/charts/consul/test/unit/create-federation-secret-role.bats b/charts/consul/test/unit/create-federation-secret-role.bats index 99f8dfd120..9cb9549dd0 100644 --- a/charts/consul/test/unit/create-federation-secret-role.bats +++ b/charts/consul/test/unit/create-federation-secret-role.bats @@ -38,7 +38,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ --set 'global.acls.createReplicationToken=true' \ . | tee /dev/stderr | - yq -r '.rules | map(select(.resourceNames[0] == "RELEASE-NAME-consul-acl-replication-acl-token")) | length' | tee /dev/stderr) + yq -r '.rules | map(select(.resourceNames[0] == "release-name-consul-acl-replication-acl-token")) | length' | tee /dev/stderr) [ "${actual}" = "1" ] } diff --git a/charts/consul/test/unit/enterprise-license-job.bats b/charts/consul/test/unit/enterprise-license-job.bats index cbdb913df6..314539390d 100644 --- a/charts/consul/test/unit/enterprise-license-job.bats +++ b/charts/consul/test/unit/enterprise-license-job.bats @@ -155,7 +155,7 @@ load _helpers --set 'global.tls.enabled=false' \ . | tee /dev/stderr | yq -r '.spec.template.spec.containers[0].env[] | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = "http://RELEASE-NAME-consul-server:8500" ] + [ "${actual}" = "http://release-name-consul-server:8500" ] } @test "enterpriseLicense/Job: URL is https when TLS is enabled" { @@ -168,7 +168,7 @@ load _helpers --set 'global.tls.enabled=true' \ . | tee /dev/stderr | yq -r '.spec.template.spec.containers[0].env[] | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = "https://RELEASE-NAME-consul-server:8501" ] + [ "${actual}" = "https://release-name-consul-server:8501" ] } @test "enterpriseLicense/Job: CA certificate is specified when TLS is enabled" { diff --git a/charts/consul/test/unit/enterprise-license-role.bats b/charts/consul/test/unit/enterprise-license-role.bats index e30d0cfd16..b20554b017 100644 --- a/charts/consul/test/unit/enterprise-license-role.bats +++ b/charts/consul/test/unit/enterprise-license-role.bats @@ -65,7 +65,7 @@ load _helpers --set 'global.enterpriseLicense.enableLicenseAutoload=false' \ --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | - yq -r '.rules | map(select(.resourceNames[0] == "RELEASE-NAME-consul-enterprise-license-acl-token")) | length' | tee /dev/stderr) + yq -r '.rules | map(select(.resourceNames[0] == "release-name-consul-enterprise-license-acl-token")) | length' | tee /dev/stderr) [ "${actual}" = "1" ] } diff --git a/charts/consul/test/unit/helpers.bats b/charts/consul/test/unit/helpers.bats index 181df6a34c..4245b519c4 100644 --- a/charts/consul/test/unit/helpers.bats +++ b/charts/consul/test/unit/helpers.bats @@ -8,13 +8,13 @@ load _helpers # These tests use test-runner.yaml to test the consul.fullname helper # since we need an existing template that calls the consul.fullname helper. -@test "helper/consul.fullname: defaults to RELEASE-NAME-consul" { +@test "helper/consul.fullname: defaults to release-name-consul" { cd `chart_dir` local actual=$(helm template \ -s templates/tests/test-runner.yaml \ . | tee /dev/stderr | yq -r '.metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-test" ] + [ "${actual}" = "release-name-consul-test" ] } @test "helper/consul.fullname: fullnameOverride overrides the name" { @@ -84,7 +84,7 @@ load _helpers --set nameOverride=override \ . | tee /dev/stderr | yq -r '.metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-override-test" ] + [ "${actual}" = "release-name-override-test" ] } #-------------------------------------------------------------------- @@ -149,7 +149,7 @@ load _helpers yq '.spec.initContainers[] | select(.name == "get-auto-encrypt-client-ca").command | join(" ")' | tee /dev/stderr) # check server address - actual=$(echo $command | jq ' . | contains("-server-addr=RELEASE-NAME-consul-server")') + actual=$(echo $command | jq ' . | contains("-server-addr=release-name-consul-server")') [ "${actual}" = "true" ] # check server port diff --git a/charts/consul/test/unit/ingress-gateways-deployment.bats b/charts/consul/test/unit/ingress-gateways-deployment.bats index ebe59d9489..da32d6ee3d 100644 --- a/charts/consul/test/unit/ingress-gateways-deployment.bats +++ b/charts/consul/test/unit/ingress-gateways-deployment.bats @@ -22,7 +22,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | yq -r '.metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-ingress-gateway" ] + [ "${actual}" = "release-name-consul-ingress-gateway" ] } @test "ingressGateways/Deployment: serviceAccountName is set properly" { @@ -36,7 +36,7 @@ load _helpers . | tee /dev/stderr | yq -s -r '.[0].spec.template.spec.serviceAccountName' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-ingress-gateway" ] + [ "${actual}" = "release-name-consul-ingress-gateway" ] } @test "ingressGateways/Deployment: Adds consul service volumeMount to gateway container" { @@ -1325,7 +1325,7 @@ key2: value2' \ -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-ingress-gateway \ + -name=release-name-consul-ingress-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT=8080 @@ -1385,8 +1385,8 @@ EOF yq -s -r '.[0].spec.template.spec.initContainers | map(select(.name == "ingress-gateway-init"))[0] | .command[2]' | tee /dev/stderr) exp='consul-k8s-control-plane acl-init \ - -component-name=ingress-gateway/RELEASE-NAME-consul-ingress-gateway \ - -acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method \ + -component-name=ingress-gateway/release-name-consul-ingress-gateway \ + -acl-auth-method=release-name-consul-k8s-component-auth-method \ -token-sink-file=/consul/service/acl-token \ -log-level=info \ -log-json=false @@ -1395,7 +1395,7 @@ consul-k8s-control-plane service-address \ -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-ingress-gateway \ + -name=release-name-consul-ingress-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT=8080 @@ -1622,10 +1622,10 @@ EOF yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[0] | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] diff --git a/charts/consul/test/unit/ingress-gateways-podsecuritypolicy.bats b/charts/consul/test/unit/ingress-gateways-podsecuritypolicy.bats index 18fa9283d1..3798fdc5e6 100644 --- a/charts/consul/test/unit/ingress-gateways-podsecuritypolicy.bats +++ b/charts/consul/test/unit/ingress-gateways-podsecuritypolicy.bats @@ -43,8 +43,8 @@ load _helpers [ "${actual}" = "false" ] local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] } diff --git a/charts/consul/test/unit/ingress-gateways-role.bats b/charts/consul/test/unit/ingress-gateways-role.bats index d592820b8b..7f00ab19d7 100644 --- a/charts/consul/test/unit/ingress-gateways-role.bats +++ b/charts/consul/test/unit/ingress-gateways-role.bats @@ -46,7 +46,7 @@ load _helpers [ "${actual}" = "secrets" ] local actual=$(echo $object | yq -r '.resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-ingress-gateway-acl-token" ] + [ "${actual}" = "release-name-consul-ingress-gateway-acl-token" ] } @test "ingressGateways/Role: rules for ingressGateways service" { @@ -87,10 +87,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[0].rules | length' | tee /dev/stderr) [ "${actual}" = "3" ] diff --git a/charts/consul/test/unit/ingress-gateways-rolebinding.bats b/charts/consul/test/unit/ingress-gateways-rolebinding.bats index 55f7d51756..4708b214ea 100644 --- a/charts/consul/test/unit/ingress-gateways-rolebinding.bats +++ b/charts/consul/test/unit/ingress-gateways-rolebinding.bats @@ -32,10 +32,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[2] | length > 0' | tee /dev/stderr) [ "${actual}" = "false" ] diff --git a/charts/consul/test/unit/ingress-gateways-service.bats b/charts/consul/test/unit/ingress-gateways-service.bats index 8fa3c73482..80afcb353f 100644 --- a/charts/consul/test/unit/ingress-gateways-service.bats +++ b/charts/consul/test/unit/ingress-gateways-service.bats @@ -333,7 +333,7 @@ key2: value2' \ --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -s -r '.[0].spec.selector."ingress-gateway-name"' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-ingress-gateway" ] + [ "${actual}" = "release-name-consul-ingress-gateway" ] } #-------------------------------------------------------------------- @@ -351,10 +351,10 @@ key2: value2' \ yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[2] | length > 0' | tee /dev/stderr) [ "${actual}" = "false" ] diff --git a/charts/consul/test/unit/ingress-gateways-serviceaccount.bats b/charts/consul/test/unit/ingress-gateways-serviceaccount.bats index 12316908ea..0660aef639 100644 --- a/charts/consul/test/unit/ingress-gateways-serviceaccount.bats +++ b/charts/consul/test/unit/ingress-gateways-serviceaccount.bats @@ -57,10 +57,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo "$object" | yq -r '.[2] | length > 0' | tee /dev/stderr) diff --git a/charts/consul/test/unit/mesh-gateway-clusterrolebinding.bats b/charts/consul/test/unit/mesh-gateway-clusterrolebinding.bats index 71da07b2cc..b3b39a07f0 100644 --- a/charts/consul/test/unit/mesh-gateway-clusterrolebinding.bats +++ b/charts/consul/test/unit/mesh-gateway-clusterrolebinding.bats @@ -28,6 +28,6 @@ load _helpers --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -r '.subjects[0].name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-mesh-gateway" ] + [ "${actual}" = "release-name-consul-mesh-gateway" ] } diff --git a/charts/consul/test/unit/mesh-gateway-deployment.bats b/charts/consul/test/unit/mesh-gateway-deployment.bats index d4adca93b7..dca82bed00 100755 --- a/charts/consul/test/unit/mesh-gateway-deployment.bats +++ b/charts/consul/test/unit/mesh-gateway-deployment.bats @@ -702,7 +702,7 @@ key2: value2' \ [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -800,7 +800,7 @@ key2: value2' \ [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -1060,7 +1060,7 @@ key2: value2' \ -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" @@ -1111,7 +1111,7 @@ EOF exp='consul-k8s-control-plane acl-init \ -component-name=mesh-gateway \ -token-sink-file=/consul/service/acl-token \ - -acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method \ + -acl-auth-method=release-name-consul-k8s-component-auth-method \ -log-level=info \ -log-json=false @@ -1119,7 +1119,7 @@ consul-k8s-control-plane service-address \ -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" @@ -1173,7 +1173,7 @@ EOF -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" @@ -1452,7 +1452,7 @@ EOF -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" @@ -1571,7 +1571,7 @@ EOF -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" @@ -1623,7 +1623,7 @@ EOF -log-level=info \ -log-json=false \ -k8s-namespace=default \ - -name=RELEASE-NAME-consul-mesh-gateway \ + -name=release-name-consul-mesh-gateway \ -output-file=/tmp/address.txt WAN_ADDR="$(cat /tmp/address.txt)" WAN_PORT="443" diff --git a/charts/consul/test/unit/server-acl-init-cleanup-job.bats b/charts/consul/test/unit/server-acl-init-cleanup-job.bats index 5b60a590ee..3cc17b2682 100644 --- a/charts/consul/test/unit/server-acl-init-cleanup-job.bats +++ b/charts/consul/test/unit/server-acl-init-cleanup-job.bats @@ -55,7 +55,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | yq -c '.spec.template.spec.containers[0].args' | tee /dev/stderr) - [ "${actual}" = '["delete-completed-job","-log-level=info","-log-json=false","-k8s-namespace=default","RELEASE-NAME-consul-server-acl-init"]' ] + [ "${actual}" = '["delete-completed-job","-log-level=info","-log-json=false","-k8s-namespace=default","release-name-consul-server-acl-init"]' ] } @test "serverACLInitCleanup/Job: enabled with externalServers.enabled=true and global.acls.manageSystemACLs=true, but server.enabled set to false" { diff --git a/charts/consul/test/unit/server-config-configmap.bats b/charts/consul/test/unit/server-config-configmap.bats index 2a8d1d39c8..203350fc51 100755 --- a/charts/consul/test/unit/server-config-configmap.bats +++ b/charts/consul/test/unit/server-config-configmap.bats @@ -59,7 +59,7 @@ load _helpers . | tee /dev/stderr | yq -r '.data["server.json"]' | jq -r .retry_join[0] | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-server.default.svc:8301" ] + [ "${actual}" = "release-name-consul-server.default.svc:8301" ] } #-------------------------------------------------------------------- @@ -95,7 +95,7 @@ load _helpers . | tee /dev/stderr | yq -r '.data["server.json"]' | jq -r .retry_join[0] | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-server.default.svc:9301" ] + [ "${actual}" = "release-name-consul-server.default.svc:9301" ] } @test "server/ConfigMap: recursors can be set by global.recursors" { diff --git a/charts/consul/test/unit/server-role.bats b/charts/consul/test/unit/server-role.bats index e9bc7cbd37..2276e48645 100644 --- a/charts/consul/test/unit/server-role.bats +++ b/charts/consul/test/unit/server-role.bats @@ -85,7 +85,7 @@ load _helpers --set 'server.exposeGossipAndRPCPorts=true' \ . | tee /dev/stderr | yq -r '.rules[] | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-server" ] + [ "${actual}" = "release-name-consul-server" ] } @test "server/Role: allows SCC and PSP access with global.openshift.enabled=true,server.exposeGossipAndRPCPorts=true and global.enablePodSecurityPolices=true" { @@ -100,8 +100,8 @@ load _helpers yq -r '.rules[]' | tee /dev/stderr) local scc_resource=$(echo $rules | jq -r '. | select(.resources==["securitycontextconstraints"]) | .resourceNames[0]') - [ "${scc_resource}" = "RELEASE-NAME-consul-server" ] + [ "${scc_resource}" = "release-name-consul-server" ] local psp_resource=$(echo $rules | jq -r '. | select(.resources==["podsecuritypolicies"]) | .resourceNames[0]') - [ "${psp_resource}" = "RELEASE-NAME-consul-server" ] + [ "${psp_resource}" = "release-name-consul-server" ] } diff --git a/charts/consul/test/unit/server-statefulset.bats b/charts/consul/test/unit/server-statefulset.bats index 9c5306b88a..caa1bc0633 100755 --- a/charts/consul/test/unit/server-statefulset.bats +++ b/charts/consul/test/unit/server-statefulset.bats @@ -208,7 +208,7 @@ load _helpers local actual=$(echo "$object" | yq -r '.spec.template.spec.volumes[2].secret.secretName' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-server-cert" ] + [ "${actual}" = "release-name-consul-server-cert" ] } @test "server/StatefulSet: consul-server-cert uses serverCert.secretName when serverCert (and caCert) are set" { @@ -671,7 +671,7 @@ load _helpers -s templates/server-statefulset.yaml \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = 5302306ae80c4a74dc23c90c24b23064c8d6c00ad1a7b981763e23cfcc8c71f1 ] + [ "${actual}" = 4c8adc33d5123dd1decbbe11d4999a3a8dd209003df703fe5035b0591e904624 ] } @test "server/StatefulSet: adds config-checksum annotation when extraConfig is provided" { @@ -681,7 +681,7 @@ load _helpers --set 'server.extraConfig="{\"hello\": \"world\"}"' \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = 6c2ac4d32ceda09ae07cbe6a4e118908f9167bad765a1db6b37a5c6a93c279a4 ] + [ "${actual}" = 472da13553591e000f0354a013c661955fd4ee1b7dade29570785d8eb303182a ] } @test "server/StatefulSet: adds config-checksum annotation when config is updated" { @@ -691,7 +691,7 @@ load _helpers --set 'global.acls.manageSystemACLs=true' \ . | tee /dev/stderr | yq -r '.spec.template.metadata.annotations."consul.hashicorp.com/config-checksum"' | tee /dev/stderr) - [ "${actual}" = c6712ea13c42769198eecfbdaaf18d5922e9495a1dc14523522f28dec50d33f8 ] + [ "${actual}" = a42be230e4c41dc0d3c239d099bd90b9e43b2a17b904d2a32fe9c8622d8f2194 ] } #-------------------------------------------------------------------- @@ -846,7 +846,7 @@ load _helpers -s templates/server-statefulset.yaml \ --set 'global.gossipEncryption.autoGenerate=true' \ . | tee /dev/stderr | - yq '.spec.template.spec.containers[] | select(.name=="consul") | .env[] | select(.name == "GOSSIP_KEY") | .valueFrom.secretKeyRef | [.name=="RELEASE-NAME-consul-gossip-encryption-key", .key="key"] | all' | tee /dev/stderr) + yq '.spec.template.spec.containers[] | select(.name=="consul") | .env[] | select(.name == "GOSSIP_KEY") | .valueFrom.secretKeyRef | [.name=="release-name-consul-gossip-encryption-key", .key="key"] | all' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -1668,7 +1668,7 @@ load _helpers local actual=$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.crt"]' | tee /dev/stderr) - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] local actual="$(echo $object | @@ -1677,7 +1677,7 @@ load _helpers local actual="$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.key"]' | tee /dev/stderr)" - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] } @@ -1724,12 +1724,12 @@ load _helpers local actual=$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.crt"]' | tee /dev/stderr) - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul,*.foo.com,*.bar.com\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul,*.foo.com,*.bar.com\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] local actual="$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.key"]' | tee /dev/stderr)" - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul,*.foo.com,*.bar.com\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul,*.foo.com,*.bar.com\" \"ip_sans=127.0.0.1\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] } @@ -1753,12 +1753,12 @@ load _helpers local actual=$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.crt"]' | tee /dev/stderr) - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1,1.1.1.1,2.2.2.2\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1,1.1.1.1,2.2.2.2\" -}}\n{{- .Data.certificate -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] local actual="$(echo $object | yq -r '.metadata.annotations["vault.hashicorp.com/agent-inject-template-servercert.key"]' | tee /dev/stderr)" - local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server,*.RELEASE-NAME-consul-server.default,RELEASE-NAME-consul-server.default,*.RELEASE-NAME-consul-server.default.svc,RELEASE-NAME-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1,1.1.1.1,2.2.2.2\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' + local expected=$'{{- with secret \"pki_int/issue/test\" \"common_name=server.dc2.consul\"\n\"alt_names=localhost,release-name-consul-server,*.release-name-consul-server,*.release-name-consul-server.default,release-name-consul-server.default,*.release-name-consul-server.default.svc,release-name-consul-server.default.svc,*.server.dc2.consul\" \"ip_sans=127.0.0.1,1.1.1.1,2.2.2.2\" -}}\n{{- .Data.private_key -}}\n{{- end -}}' [ "${actual}" = "${expected}" ] } diff --git a/charts/consul/test/unit/sync-catalog-deployment.bats b/charts/consul/test/unit/sync-catalog-deployment.bats index 461ffd84f2..070835c949 100755 --- a/charts/consul/test/unit/sync-catalog-deployment.bats +++ b/charts/consul/test/unit/sync-catalog-deployment.bats @@ -531,7 +531,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -626,7 +626,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method"))' | tee /dev/stderr) [ "${actual}" = "true" ] } @@ -652,7 +652,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | - yq -r '.command | any(contains("-acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) + yq -r '.command | any(contains("-acl-auth-method=release-name-consul-k8s-component-auth-method-dc2"))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo $object | @@ -1083,7 +1083,7 @@ load _helpers local actual actual=$(echo $env | jq -r '. | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = 'https://RELEASE-NAME-consul-server:8501' ] + [ "${actual}" = 'https://release-name-consul-server:8501' ] actual=$(echo $env | jq -r '. | select(.name == "CONSUL_CACERT") | .value' | tee /dev/stderr) [ "${actual}" = "/consul/tls/ca/tls.crt" ] @@ -1101,7 +1101,7 @@ load _helpers local actual actual=$(echo $env | jq -r '. | select(.name == "CONSUL_HTTP_ADDR") | .value' | tee /dev/stderr) - [ "${actual}" = 'https://RELEASE-NAME-consul-server:8501' ] + [ "${actual}" = 'https://release-name-consul-server:8501' ] actual=$(echo $env | jq -r '. | select(.name == "CONSUL_CACERT") | .value' | tee /dev/stderr) [ "${actual}" = "/consul/tls/ca/tls.crt" ] diff --git a/charts/consul/test/unit/terminating-gateways-deployment.bats b/charts/consul/test/unit/terminating-gateways-deployment.bats index 2d6fe575d3..7ffd1f1c6e 100644 --- a/charts/consul/test/unit/terminating-gateways-deployment.bats +++ b/charts/consul/test/unit/terminating-gateways-deployment.bats @@ -22,7 +22,7 @@ load _helpers [ "${actual}" = "true" ] local actual=$(echo $object | yq -r '.metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-terminating-gateway" ] + [ "${actual}" = "release-name-consul-terminating-gateway" ] } @test "terminatingGateways/Deployment: Adds consul service volumeMount to gateway container" { @@ -296,7 +296,7 @@ load _helpers . | tee /dev/stderr | yq -s -r '.[0].spec.template.spec.serviceAccountName' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-terminating-gateway" ] + [ "${actual}" = "release-name-consul-terminating-gateway" ] } #-------------------------------------------------------------------- @@ -1206,8 +1206,8 @@ EOF yq -s -r '.[0].spec.template.spec.initContainers | map(select(.name == "terminating-gateway-init"))[0] | .command[2]' | tee /dev/stderr) exp='consul-k8s-control-plane acl-init \ - -component-name=terminating-gateway/RELEASE-NAME-consul-terminating \ - -acl-auth-method=RELEASE-NAME-consul-k8s-component-auth-method \ + -component-name=terminating-gateway/release-name-consul-terminating \ + -acl-auth-method=release-name-consul-k8s-component-auth-method \ -token-sink-file=/consul/service/acl-token \ -log-level=info \ -log-json=false @@ -1437,10 +1437,10 @@ EOF yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[0] | length > 0' | tee /dev/stderr) [ "${actual}" = "true" ] diff --git a/charts/consul/test/unit/terminating-gateways-podsecuritypolicy.bats b/charts/consul/test/unit/terminating-gateways-podsecuritypolicy.bats index b8595f8e60..63af96ffb2 100644 --- a/charts/consul/test/unit/terminating-gateways-podsecuritypolicy.bats +++ b/charts/consul/test/unit/terminating-gateways-podsecuritypolicy.bats @@ -43,8 +43,8 @@ load _helpers [ "${actual}" = "false" ] local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] } diff --git a/charts/consul/test/unit/terminating-gateways-role.bats b/charts/consul/test/unit/terminating-gateways-role.bats index 708df66a6c..f109a2dd23 100644 --- a/charts/consul/test/unit/terminating-gateways-role.bats +++ b/charts/consul/test/unit/terminating-gateways-role.bats @@ -46,7 +46,7 @@ load _helpers [ "${actual}" = "secrets" ] local actual=$(echo $object | yq -r '.resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-terminating-gateway-acl-token" ] + [ "${actual}" = "release-name-consul-terminating-gateway-acl-token" ] } @test "terminatingGateways/Role: rules is empty if no ACLs, PSPs" { @@ -87,10 +87,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[0].rules | length' | tee /dev/stderr) [ "${actual}" = "2" ] diff --git a/charts/consul/test/unit/terminating-gateways-rolebinding.bats b/charts/consul/test/unit/terminating-gateways-rolebinding.bats index d6e74be896..0404954ee4 100644 --- a/charts/consul/test/unit/terminating-gateways-rolebinding.bats +++ b/charts/consul/test/unit/terminating-gateways-rolebinding.bats @@ -32,10 +32,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo $object | yq '.[2] | length > 0' | tee /dev/stderr) [ "${actual}" = "false" ] diff --git a/charts/consul/test/unit/terminating-gateways-serviceaccount.bats b/charts/consul/test/unit/terminating-gateways-serviceaccount.bats index 3052907b54..b24e8b5303 100644 --- a/charts/consul/test/unit/terminating-gateways-serviceaccount.bats +++ b/charts/consul/test/unit/terminating-gateways-serviceaccount.bats @@ -57,10 +57,10 @@ load _helpers yq -s -r '.' | tee /dev/stderr) local actual=$(echo $object | yq -r '.[0].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway1" ] + [ "${actual}" = "release-name-consul-gateway1" ] local actual=$(echo $object | yq -r '.[1].metadata.name' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-gateway2" ] + [ "${actual}" = "release-name-consul-gateway2" ] local actual=$(echo "$object" | yq -r '.[2] | length > 0' | tee /dev/stderr) diff --git a/charts/consul/test/unit/tls-init-cleanup-role.bats b/charts/consul/test/unit/tls-init-cleanup-role.bats index cfcf5be7ba..0f70ad8264 100644 --- a/charts/consul/test/unit/tls-init-cleanup-role.bats +++ b/charts/consul/test/unit/tls-init-cleanup-role.bats @@ -68,7 +68,7 @@ load _helpers . | tee /dev/stderr | yq -r '.rules[] | select(.resources==["podsecuritypolicies"]) | .resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-tls-init-cleanup" ] + [ "${actual}" = "release-name-consul-tls-init-cleanup" ] } #-------------------------------------------------------------------- diff --git a/charts/consul/test/unit/tls-init-job.bats b/charts/consul/test/unit/tls-init-job.bats index bf4d116574..6c148ed074 100644 --- a/charts/consul/test/unit/tls-init-job.bats +++ b/charts/consul/test/unit/tls-init-job.bats @@ -79,22 +79,22 @@ load _helpers yq '.spec.template.spec.containers[0].command' | tee /dev/stderr) local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"RELEASE-NAME-consul-server\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"release-name-consul-server\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"*.RELEASE-NAME-consul-server\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"*.release-name-consul-server\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"*.RELEASE-NAME-consul-server.${NAMESPACE}\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"*.release-name-consul-server.${NAMESPACE}\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"RELEASE-NAME-consul-server.${NAMESPACE}\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"release-name-consul-server.${NAMESPACE}\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"*.RELEASE-NAME-consul-server.${NAMESPACE}.svc\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"*.release-name-consul-server.${NAMESPACE}.svc\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | - yq 'any(contains("additional-dnsname=\"RELEASE-NAME-consul-server.${NAMESPACE}.svc\""))' | tee /dev/stderr) + yq 'any(contains("additional-dnsname=\"release-name-consul-server.${NAMESPACE}.svc\""))' | tee /dev/stderr) [ "${actual}" = "true" ] local actual=$(echo "$command" | yq 'any(contains("additional-dnsname=\"*.server.dc1.consul\""))' | tee /dev/stderr) diff --git a/charts/consul/test/unit/tls-init-role.bats b/charts/consul/test/unit/tls-init-role.bats index 12af5ed2d0..9108441501 100644 --- a/charts/consul/test/unit/tls-init-role.bats +++ b/charts/consul/test/unit/tls-init-role.bats @@ -68,7 +68,7 @@ load _helpers . | tee /dev/stderr | yq -r '.rules[] | select(.resources==["podsecuritypolicies"]) | .resourceNames[0]' | tee /dev/stderr) - [ "${actual}" = "RELEASE-NAME-consul-tls-init" ] + [ "${actual}" = "release-name-consul-tls-init" ] } #--------------------------------------------------------------------