From fd07b6d81beb7db96085725dbdf953785e0bbfcf Mon Sep 17 00:00:00 2001 From: Ashwin Venkatesh Date: Wed, 15 Dec 2021 00:42:36 -0500 Subject: [PATCH] Support consul 1.11.0 --- .circleci/config.yml | 4 ++-- CHANGELOG.md | 6 +++++- acceptance/go.mod | 4 ++-- acceptance/go.sum | 11 ++++------- .../controller/controller_namespaces_test.go | 2 -- acceptance/tests/partitions/partitions_test.go | 6 ------ charts/consul/Chart.yaml | 12 ++++++------ charts/consul/templates/server-statefulset.yaml | 4 ---- .../test/unit/ingress-gateways-deployment.bats | 2 +- .../test/unit/mesh-gateway-deployment.bats | 2 +- charts/consul/test/unit/server-statefulset.bats | 9 --------- .../unit/terminating-gateways-deployment.bats | 2 +- charts/consul/test/unit/ui-ingress.bats | 16 ---------------- charts/consul/values.yaml | 6 +++--- control-plane/go.mod | 5 ++--- control-plane/go.sum | 9 ++++----- .../subcommand/consul-sidecar/command_test.go | 8 ++++---- .../create-federation-secret/command_test.go | 2 +- .../get-consul-client-ca/command_test.go | 2 +- .../subcommand/server-acl-init/command_test.go | 2 +- 20 files changed, 38 insertions(+), 76 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index da32949865..592e713d3a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,8 +9,8 @@ executors: - image: docker.mirror.hashicorp.services/cimg/go:1.17.5 environment: TEST_RESULTS: /tmp/test-results # path to where test results are saved - CONSUL_VERSION: 1.11.0-rc # Consul's OSS version to use in tests - CONSUL_ENT_VERSION: 1.11.0+ent-rc # Consul's enterprise version to use in tests + CONSUL_VERSION: 1.11.0 # Consul's OSS version to use in tests + CONSUL_ENT_VERSION: 1.11.0+ent # Consul's enterprise version to use in tests control-plane-path : &control-plane-path control-plane cli-path : &cli-path cli diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a287c4bf1..5c27b853fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## UNRELEASED FEATURES: +* Helm + * Support Consul 1.11.0. [[GH-935](https://github.com/hashicorp/consul-k8s/pull/935)] + * Support Envoy 1.20.0. [[GH-935](https://github.com/hashicorp/consul-k8s/pull/935)] + * Minimum Kubernetes versions supported is 1.18+. [[GH-935](https://github.com/hashicorp/consul-k8s/pull/935)] * CLI * **BETA** Add `upgrade` command to modify Consul installation on Kubernetes. [[GH-898](https://github.com/hashicorp/consul-k8s/pull/898)] @@ -27,7 +31,7 @@ FEATURES: Requirements: * Consul 1.11+ - * Vault 1.19+ and Vault-K8s 0.14+ must be installed with the Vault Agent Injector enabled (`injector.enabled=true`) + * Vault 1.9+ and Vault-K8s 0.14+ must be installed with the Vault Agent Injector enabled (`injector.enabled=true`) into the Kubernetes cluster that Consul is installed into. * `global.tls.enableAutoEncryption=true` is required for TLS support. * If TLS is enabled in Vault, `global.secretsBackend.vault.ca` must be provided and should reference a Kube secret diff --git a/acceptance/go.mod b/acceptance/go.mod index f91df929e2..1acd9d13eb 100644 --- a/acceptance/go.mod +++ b/acceptance/go.mod @@ -5,8 +5,8 @@ go 1.17 require ( github.com/gruntwork-io/terratest v0.31.2 github.com/hashicorp/consul-k8s/control-plane v0.0.0-20211207212234-aea9efea5638 - github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc - github.com/hashicorp/consul/sdk v0.8.0 + github.com/hashicorp/consul/api v1.12.0 + github.com/hashicorp/consul/sdk v0.9.0 github.com/hashicorp/vault/api v1.2.0 github.com/stretchr/testify v1.7.0 gopkg.in/yaml.v2 v2.4.0 diff --git a/acceptance/go.sum b/acceptance/go.sum index 3459220dc4..b71514cc25 100644 --- a/acceptance/go.sum +++ b/acceptance/go.sum @@ -387,15 +387,12 @@ github.com/hashicorp/consul-k8s/control-plane v0.0.0-20211207212234-aea9efea5638 github.com/hashicorp/consul-k8s/control-plane v0.0.0-20211207212234-aea9efea5638/go.mod h1:7ZeaiADGbvJDuoWAT8UKj6KCcLsFUk+34OkUGMVtdXg= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.10.1-0.20211116182834-e6956893fb6f/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc h1:tUgL1cinAFDtidyKqgsJzlxLkEi9atLmN6j8kgCr17Q= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc h1:tUgL1cinAFDtidyKqgsJzlxLkEi9atLmN6j8kgCr17Q= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/api v1.12.0 h1:k3y1FYv6nuKyNTqj6w9gXOx5r5CfLj/k/euUeBXj1OY= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc h1:tUgL1cinAFDtidyKqgsJzlxLkEi9atLmN6j8kgCr17Q= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/hashicorp/consul/sdk v0.9.0 h1:NGSHAU7X3yDCjo8WBUbNOtD3BSqv8u0vu3+zNxgmxQI= +github.com/hashicorp/consul/sdk v0.9.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= diff --git a/acceptance/tests/controller/controller_namespaces_test.go b/acceptance/tests/controller/controller_namespaces_test.go index b272247db4..b590d05b9e 100644 --- a/acceptance/tests/controller/controller_namespaces_test.go +++ b/acceptance/tests/controller/controller_namespaces_test.go @@ -74,8 +74,6 @@ func TestControllerNamespaces(t *testing.T) { ctx := suite.Environment().DefaultContext(t) helmValues := map[string]string{ - "global.image": "hashicorp/consul-enterprise:1.11.0-ent-rc", - "global.enableConsulNamespaces": "true", "global.adminPartitions.enabled": "true", "controller.enabled": "true", diff --git a/acceptance/tests/partitions/partitions_test.go b/acceptance/tests/partitions/partitions_test.go index 357e2f6d85..9fb8d8b97b 100644 --- a/acceptance/tests/partitions/partitions_test.go +++ b/acceptance/tests/partitions/partitions_test.go @@ -36,10 +36,6 @@ func TestPartitions(t *testing.T) { t.Skipf("skipping this test because Admin Partition tests are only supported in Kind for now") } - if cfg.EnableTransparentProxy { - t.Skipf("skipping this test as Transparent Proxy behavior is flaky") - } - const defaultPartition = "default" const secondaryPartition = "secondary" const defaultNamespace = "default" @@ -96,7 +92,6 @@ func TestPartitions(t *testing.T) { serverHelmValues := map[string]string{ "global.datacenter": "dc1", - "global.image": "hashicorp/consul-enterprise:1.11.0-ent-rc", "global.adminPartitions.enabled": "true", "global.enableConsulNamespaces": "true", @@ -197,7 +192,6 @@ func TestPartitions(t *testing.T) { // Create client cluster. clientHelmValues := map[string]string{ "global.datacenter": "dc1", - "global.image": "hashicorp/consul-enterprise:1.11.0-ent-rc", "global.enabled": "false", "global.tls.enabled": "true", diff --git a/charts/consul/Chart.yaml b/charts/consul/Chart.yaml index 0057b0780b..1a644d5ed6 100644 --- a/charts/consul/Chart.yaml +++ b/charts/consul/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: consul -version: 0.38.0 -appVersion: 1.10.4 -kubeVersion: ">=1.17.0-0" +version: 0.39.0 +appVersion: 1.11.0 +kubeVersion: ">=1.18.0-0" description: Official HashiCorp Consul Chart home: https://www.consul.io icon: https://raw.githubusercontent.com/hashicorp/consul-k8s/main/assets/icon.png @@ -13,11 +13,11 @@ annotations: artifacthub.io/prerelease: false artifacthub.io/images: | - name: consul - image: hashicorp/consul:1.10.4 + image: hashicorp/consul:1.11.0 - name: consul-k8s-control-plane - image: hashicorp/consul-k8s-control-plane:0.38.0 + image: hashicorp/consul-k8s-control-plane:0.39.0 - name: envoy - image: envoyproxy/envoy-alpine:v1.18.4 + image: envoyproxy/envoy-alpine:v1.20.0 artifacthub.io/license: MPL-2.0 artifacthub.io/links: | - name: Documentation diff --git a/charts/consul/templates/server-statefulset.yaml b/charts/consul/templates/server-statefulset.yaml index 6803d2e760..16fae492ef 100644 --- a/charts/consul/templates/server-statefulset.yaml +++ b/charts/consul/templates/server-statefulset.yaml @@ -96,12 +96,8 @@ spec: {{ tpl .Values.server.tolerations . | nindent 8 | trim }} {{- end }} {{- if .Values.server.topologySpreadConstraints }} - {{- if and (ge .Capabilities.KubeVersion.Major "1") (ge .Capabilities.KubeVersion.Minor "18") }} topologySpreadConstraints: {{ tpl .Values.server.topologySpreadConstraints . | nindent 8 | trim }} - {{- else }} - {{- fail "`topologySpreadConstraints` requires Kubernetes 1.18 and above." }} - {{- end }} {{- end }} terminationGracePeriodSeconds: 30 serviceAccountName: {{ template "consul.fullname" . }}-server diff --git a/charts/consul/test/unit/ingress-gateways-deployment.bats b/charts/consul/test/unit/ingress-gateways-deployment.bats index ee1ac5f303..c22e325771 100644 --- a/charts/consul/test/unit/ingress-gateways-deployment.bats +++ b/charts/consul/test/unit/ingress-gateways-deployment.bats @@ -83,7 +83,7 @@ load _helpers --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -s -r '.[0].spec.template.spec.containers[0].image' | tee /dev/stderr) - [ "${actual}" = "envoyproxy/envoy-alpine:v1.18.4" ] + [ "${actual}" = "envoyproxy/envoy-alpine:v1.20.0" ] } @test "ingressGateways/Deployment: envoy image can be set using the global value" { diff --git a/charts/consul/test/unit/mesh-gateway-deployment.bats b/charts/consul/test/unit/mesh-gateway-deployment.bats index f1af2fc2b2..37464b9676 100755 --- a/charts/consul/test/unit/mesh-gateway-deployment.bats +++ b/charts/consul/test/unit/mesh-gateway-deployment.bats @@ -335,7 +335,7 @@ key2: value2' \ --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -r '.spec.template.spec.containers[0].image' | tee /dev/stderr) - [ "${actual}" = "envoyproxy/envoy-alpine:v1.18.4" ] + [ "${actual}" = "envoyproxy/envoy-alpine:v1.20.0" ] } @test "meshGateway/Deployment: setting meshGateway.imageEnvoy fails" { diff --git a/charts/consul/test/unit/server-statefulset.bats b/charts/consul/test/unit/server-statefulset.bats index 15c03711db..c1d260e296 100755 --- a/charts/consul/test/unit/server-statefulset.bats +++ b/charts/consul/test/unit/server-statefulset.bats @@ -788,15 +788,6 @@ load _helpers . | tee /dev/stderr | yq '.spec.template.spec.topologySpreadConstraints == "foobar"' | tee /dev/stderr) [ "${actual}" = "true" ] - - # todo: test for Kube versions < 1.18 when helm supports --kube-version flag (https://github.com/helm/helm/pull/9040) - # not supported before 1.18 - # run helm template \ - # -s templates/server-statefulset.yaml \ - # --kube-version "1.17" \ - # . - # [ "$status" -eq 1 ] - # [[ "$output" =~ "`topologySpreadConstraints` requires Kubernetes 1.18 and above." ]] } #-------------------------------------------------------------------- diff --git a/charts/consul/test/unit/terminating-gateways-deployment.bats b/charts/consul/test/unit/terminating-gateways-deployment.bats index e0bbdcd0a4..39f2649270 100644 --- a/charts/consul/test/unit/terminating-gateways-deployment.bats +++ b/charts/consul/test/unit/terminating-gateways-deployment.bats @@ -83,7 +83,7 @@ load _helpers --set 'connectInject.enabled=true' \ . | tee /dev/stderr | yq -s -r '.[0].spec.template.spec.containers[0].image' | tee /dev/stderr) - [ "${actual}" = "envoyproxy/envoy-alpine:v1.18.4" ] + [ "${actual}" = "envoyproxy/envoy-alpine:v1.20.0" ] } @test "terminatingGateways/Deployment: envoy image can be set using the global value" { diff --git a/charts/consul/test/unit/ui-ingress.bats b/charts/consul/test/unit/ui-ingress.bats index aaa4e56653..2c29141316 100755 --- a/charts/consul/test/unit/ui-ingress.bats +++ b/charts/consul/test/unit/ui-ingress.bats @@ -66,7 +66,6 @@ load _helpers --set 'ui.ingress.enabled=true' \ --set 'global.tls.enabled=false' \ --set 'ui.ingress.hosts[0].host=foo.com' \ - --kube-version "1.18" \ . | tee /dev/stderr | yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr) [ "${actual}" = "80" ] @@ -92,7 +91,6 @@ load _helpers --set 'ui.ingress.enabled=true' \ --set 'global.tls.enabled=true' \ --set 'ui.ingress.hosts[0].host=foo.com' \ - --kube-version "1.18" \ . | tee /dev/stderr | yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr) [ "${actual}" = "443" ] @@ -119,7 +117,6 @@ load _helpers --set 'global.tls.enabled=true' \ --set 'global.tls.httpsOnly=false' \ --set 'ui.ingress.hosts[0].host=foo.com' \ - --kube-version "1.18" \ . | tee /dev/stderr | yq -r '.spec.rules[0].http.paths[0].backend.servicePort' | tee /dev/stderr) [ "${actual}" = "80" ] @@ -147,7 +144,6 @@ load _helpers --set 'global.tls.enabled=true' \ --set 'global.tls.httpsOnly=false' \ --set 'ui.ingress.hosts[0].host=foo.com' \ - --kube-version "1.18" \ . | tee /dev/stderr | yq -r '.spec.rules[0].http.paths[1].backend.servicePort' | tee /dev/stderr) [ "${actual}" = "443" ] @@ -279,15 +275,3 @@ load _helpers [ "${actual}" = "nginx" ] } -@test "ui/Ingress: cannot set ingressClassName for Kube version < 1.18" { - cd `chart_dir` - local actual=$(helm template \ - -s templates/ui-ingress.yaml \ - --set 'ui.ingress.enabled=true' \ - --set 'ui.ingress.ingressClassName=nginx' \ - --kube-version "1.17" \ - . | tee /dev/stderr | - yq -r '.spec.ingressClassName' | tee /dev/stderr) - [ "${actual}" = "null" ] -} - diff --git a/charts/consul/values.yaml b/charts/consul/values.yaml index 7cf9156fbf..a121ce9855 100644 --- a/charts/consul/values.yaml +++ b/charts/consul/values.yaml @@ -85,7 +85,7 @@ global: # image: "hashicorp/consul-enterprise:1.10.0-ent" # ``` # @default: hashicorp/consul: - image: "hashicorp/consul:1.10.4" + image: "hashicorp/consul:1.11.0" # Array of objects containing image pull secret names that will be applied to each service account. # This can be used to reference image pull secrets if using a custom consul or consul-k8s-control-plane Docker image. @@ -105,7 +105,7 @@ global: # image that is used for functionality such as catalog sync. # This can be overridden per component. # @default: hashicorp/consul-k8s-control-plane: - imageK8S: "hashicorp/consul-k8s-control-plane:0.38.0" + imageK8S: "hashicorp/consul-k8s-control-plane:0.39.0" # The name of the datacenter that the agents should # register as. This can't be changed once the Consul cluster is up and running @@ -444,7 +444,7 @@ global: # connect-injected sidecar proxies and mesh, terminating, and ingress gateways. # See https://www.consul.io/docs/connect/proxies/envoy for full compatibility matrix between Consul and Envoy. # @default: envoyproxy/envoy-alpine: - imageEnvoy: "envoyproxy/envoy-alpine:v1.18.4" + imageEnvoy: "envoyproxy/envoy-alpine:v1.20.0" # Configuration for running this Helm chart on the Red Hat OpenShift platform. # This Helm chart currently supports OpenShift v4.x+. diff --git a/control-plane/go.mod b/control-plane/go.mod index 2e1a81424b..360aae5531 100644 --- a/control-plane/go.mod +++ b/control-plane/go.mod @@ -6,8 +6,8 @@ require ( github.com/go-logr/logr v0.4.0 github.com/google/go-cmp v0.5.6 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 - github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc - github.com/hashicorp/consul/sdk v0.8.0 + github.com/hashicorp/consul/api v1.12.0 + github.com/hashicorp/consul/sdk v0.9.0 github.com/hashicorp/go-discover v0.0.0-20200812215701-c4b85f6ed31f github.com/hashicorp/go-hclog v0.16.1 github.com/hashicorp/go-multierror v1.1.0 @@ -83,7 +83,6 @@ require ( github.com/mattn/go-isatty v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/miekg/dns v1.1.41 // indirect - github.com/mitchellh/go-testing-interface v1.14.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.1 // indirect github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 // indirect diff --git a/control-plane/go.sum b/control-plane/go.sum index 6877dd034c..18692e408c 100644 --- a/control-plane/go.sum +++ b/control-plane/go.sum @@ -297,11 +297,12 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc h1:tUgL1cinAFDtidyKqgsJzlxLkEi9atLmN6j8kgCr17Q= -github.com/hashicorp/consul/api v1.10.1-0.20211206193229-9b44861ce4bc/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= +github.com/hashicorp/consul/api v1.12.0 h1:k3y1FYv6nuKyNTqj6w9gXOx5r5CfLj/k/euUeBXj1OY= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= +github.com/hashicorp/consul/sdk v0.9.0 h1:NGSHAU7X3yDCjo8WBUbNOtD3BSqv8u0vu3+zNxgmxQI= +github.com/hashicorp/consul/sdk v0.9.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -433,8 +434,6 @@ github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/go-testing-interface v1.14.0 h1:/x0XQ6h+3U3nAyk1yx+bHPURrKa9sVVvYbuqZ7pIAtI= -github.com/mitchellh/go-testing-interface v1.14.0/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= diff --git a/control-plane/subcommand/consul-sidecar/command_test.go b/control-plane/subcommand/consul-sidecar/command_test.go index 370b4afd8f..53008ffab9 100644 --- a/control-plane/subcommand/consul-sidecar/command_test.go +++ b/control-plane/subcommand/consul-sidecar/command_test.go @@ -91,7 +91,7 @@ func TestRunSignalHandlingMetricsOnly(t *testing.T) { UI: ui, } - randomPorts := freeport.MustTake(1) + randomPorts := freeport.GetN(t, 1) // Run async because we need to kill it when the test is over. exitChan := runCommandAsynchronously(&cmd, []string{ "-enable-service-registration=false", @@ -163,7 +163,7 @@ func TestRunSignalHandlingAllProcessesEnabled(t *testing.T) { require.NoError(t, err) - randomPorts := freeport.MustTake(1) + randomPorts := freeport.GetN(t, 1) // Run async because we need to kill it when the test is over. exitChan := runCommandAsynchronously(&cmd, []string{ "-service-config", configFile, @@ -301,7 +301,7 @@ func TestMergedMetricsServer(t *testing.T) { for _, c := range cases { t.Run(c.name, func(t *testing.T) { - randomPorts := freeport.MustTake(2) + randomPorts := freeport.GetN(t, 2) ui := cli.NewMockUi() cmd := Command{ UI: ui, @@ -485,7 +485,7 @@ func TestRun_ServicesRegistration_ConsulDown(t *testing.T) { // we need to reserve all 6 ports to avoid potential // port collisions with other tests - randomPorts := freeport.MustTake(6) + randomPorts := freeport.GetN(t, 6) // Run async because we need to kill it when the test is over. exitChan := runCommandAsynchronously(&cmd, []string{ diff --git a/control-plane/subcommand/create-federation-secret/command_test.go b/control-plane/subcommand/create-federation-secret/command_test.go index 607599a27e..3a28594f18 100644 --- a/control-plane/subcommand/create-federation-secret/command_test.go +++ b/control-plane/subcommand/create-federation-secret/command_test.go @@ -944,7 +944,7 @@ func TestRun_ConsulClientDelay(t *testing.T) { // We need to reserve all 6 ports to avoid potential // port collisions with other tests. - randomPorts := freeport.MustTake(6) + randomPorts := freeport.GetN(t, 6) caFile, certFile, keyFile := test.GenerateServerCerts(t) // Create fake k8s. diff --git a/control-plane/subcommand/get-consul-client-ca/command_test.go b/control-plane/subcommand/get-consul-client-ca/command_test.go index 2f9fb4de43..8655465771 100644 --- a/control-plane/subcommand/get-consul-client-ca/command_test.go +++ b/control-plane/subcommand/get-consul-client-ca/command_test.go @@ -139,7 +139,7 @@ func TestRun_ConsulServerAvailableLater(t *testing.T) { UI: ui, } - randomPorts := freeport.MustTake(6) + randomPorts := freeport.GetN(t, 6) // Start the consul agent asynchronously var a *testutil.TestServer diff --git a/control-plane/subcommand/server-acl-init/command_test.go b/control-plane/subcommand/server-acl-init/command_test.go index 0336ba366d..efcfaacac0 100644 --- a/control-plane/subcommand/server-acl-init/command_test.go +++ b/control-plane/subcommand/server-acl-init/command_test.go @@ -1169,7 +1169,7 @@ func TestRun_DelayedServers(t *testing.T) { require := require.New(t) k8s := fake.NewSimpleClientset() - randomPorts := freeport.MustTake(6) + randomPorts := freeport.GetN(t, 6) ui := cli.NewMockUi() cmd := Command{