Skip to content

Commit

Permalink
run unit tests with latest consul binary
Browse files Browse the repository at this point in the history
  • Loading branch information
ishustava committed Oct 25, 2022
1 parent edd934f commit 9437b2c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ commands:
if ! gotestsum --no-summary=all --jsonfile=jsonfile-${pkg////-} -- $pkg -p 1 -timeout 2h -failfast \
<< parameters.additional-flags >> \
-enable-multi-cluster \
${ENABLE_ENTERPRISE:+-enable-enterprise} \
-debug-directory="$TEST_RESULTS/debug" \
-consul-k8s-image=<< parameters.consul-k8s-image >>
then
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
TEST_RESULTS: /tmp/test-results # path to where test results are saved
CONSUL_VERSION: 1.14.0-beta1 # Consul's OSS version to use in tests
CONSUL_ENT_VERSION: 1.14.0-beta1+ent # Consul's enterprise version to use in tests
GOTESTSUM_VERSION: 1.8.1 # You cannot use environment variables with workflows. The gotestsum version is hardcoded in the reusable workflows too.
GOTESTSUM_VERSION: 1.8.2 # You cannot use environment variables with workflows. The gotestsum version is hardcoded in the reusable workflows too.

jobs:
get-go-version:
Expand Down Expand Up @@ -158,11 +158,9 @@ jobs:
working-directory: control-plane
run: |
mkdir -p $HOME/bin
wget https://releases.hashicorp.com/consul/${{env.CONSUL_VERSION}}/consul_${{env.CONSUL_VERSION}}_linux_amd64.zip && \
unzip consul_${{env.CONSUL_VERSION}}_linux_amd64.zip -d $HOME/bin && \
rm consul_${{env.CONSUL_VERSION}}_linux_amd64.zip
chmod +x $HOME/bin/consul
container_id=$(docker create hashicorppreview/consul:1.14-dev)
docker cp "$container_id:/bin/consul" $HOME/bin/consul
docker rm "$container_id"
- name: Run go tests
working-directory: control-plane
run: |
Expand Down Expand Up @@ -207,10 +205,9 @@ jobs:
working-directory: control-plane
run: |
mkdir -p $HOME/bin
wget https://releases.hashicorp.com/consul/${{env.CONSUL_ENT_VERSION}}/consul_${{env.CONSUL_ENT_VERSION}}_linux_amd64.zip && \
unzip consul_${{env.CONSUL_ENT_VERSION}}_linux_amd64.zip -d $HOME/bin && \
rm consul_${{env.CONSUL_ENT_VERSION}}_linux_amd64.zip
chmod +x $HOME/bin/consul
container_id=$(docker create hashicorppreview/consul-enterprise:1.14-dev)
docker cp "$container_id:/bin/consul" $HOME/bin/consul
docker rm "$container_id"
- name: Run go tests
working-directory: control-plane
Expand Down
2 changes: 1 addition & 1 deletion acceptance/framework/consul/helm_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (h *HelmCluster) Destroy(t *testing.T) {
// Ignore the error returned by the helm delete here so that we can
// always idempotently clean up resources in the cluster.
h.helmOptions.ExtraArgs = map[string][]string{
"--wait": nil,
"--wait": nil,
}
err := helm.DeleteE(t, h.helmOptions, h.releaseName, false)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func TestReconcile_CreateUpdatePeeringAcceptor(t *testing.T) {

require.Contains(t, string(decodedTokenData), "\"CA\":")
require.Contains(t, string(decodedTokenData), "\"ServerAddresses\"")
require.Contains(t, string(decodedTokenData), "\"ServerName\":\"server.dc1.consul\"")
require.Contains(t, string(decodedTokenData), "\"ServerName\":\"server.dc1.peering.11111111-2222-3333-4444-555555555555.consul\"")

// Get the reconciled PeeringAcceptor and make assertions on the status
acceptor := &v1alpha1.PeeringAcceptor{}
Expand Down
2 changes: 1 addition & 1 deletion control-plane/subcommand/inject-connect/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func (c *Command) Run(args []string) int {
mgr.GetWebhookServer().Register("/mutate",
&webhook.Admission{Handler: &connectinject.MeshWebhook{
Clientset: c.clientset,
ReleaseNamespace: c.flagReleaseNamespace,
ReleaseNamespace: c.flagReleaseNamespace,
ConsulConfig: consulConfig,
ConsulServerConnMgr: watcher,
ImageConsul: c.flagConsulImage,
Expand Down

0 comments on commit 9437b2c

Please sign in to comment.