Skip to content

Commit

Permalink
Merge pull request hashicorp#479 from hashicorp/helm3-acceptance-tests
Browse files Browse the repository at this point in the history
Use helm v3 in acceptance tests
  • Loading branch information
ishustava authored Jun 4, 2020
2 parents 8b39bc8 + c3d4ccd commit 68f2ad5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 46 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
acceptance:
docker:
# This image is build from test/docker/Test.dockerfile
- image: hashicorpdev/consul-helm-test:0.3.0
# version 0.4.0 uses helm v3 as default
- image: hashicorpdev/consul-helm-test:0.4.0

steps:
- checkout
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ helm_install() {
fi

helm install -f ${values} \
--name consul \
consul \
--wait \
${BATS_TEST_DIRNAME}/../..
}

# helm_delete deletes the Consul chart and all resources.
helm_delete() {
helm delete --purge consul
helm delete consul
kubectl delete --all pvc
}

Expand Down
6 changes: 3 additions & 3 deletions test/docker/Test.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
# a script to configure kubectl, potentially install Helm, and run the tests
# manually. This image only has the dependencies pre-installed.

FROM alpine:latest
FROM alpine:3.11
WORKDIR /root

ENV BATS_VERSION "1.1.0"
ENV TERRAFORM_VERSION "0.12.10"
ENV TERRAFORM_VERSION "0.12.26"

# base packages
RUN apk update && apk add --no-cache --virtual .build-deps \
Expand Down Expand Up @@ -43,7 +43,7 @@ RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s
mv ./kubectl /usr/local/bin/kubectl

# helm
RUN curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
RUN curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash

# bats
RUN curl -sSL https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz -o /tmp/bats.tgz \
Expand Down
24 changes: 4 additions & 20 deletions test/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,14 @@ resource "null_resource" "kubectl" {
# want this to continue on failure. Generally, this works just fine since
# it only operates on local data.
provisioner "local-exec" {
when = "destroy"
on_failure = "continue"
when = destroy
on_failure = continue
command = "kubectl config get-clusters | grep ${google_container_cluster.cluster.name} | xargs -n1 kubectl config delete-cluster"
}

provisioner "local-exec" {
when = "destroy"
on_failure = "continue"
when = destroy
on_failure = continue
command = "kubectl config get-contexts | grep ${google_container_cluster.cluster.name} | xargs -n1 kubectl config delete-context"
}
}

resource "null_resource" "helm" {
count = var.init_cli ? 1 : 0
depends_on = ["null_resource.kubectl"]

triggers = {
cluster = google_container_cluster.cluster.id
}

provisioner "local-exec" {
command = <<EOF
kubectl apply -f '${local.service_account_path}'
helm init --service-account helm --wait
EOF
}
}
18 changes: 0 additions & 18 deletions test/terraform/service-account.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions test/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ variable "zone" {
}

variable "init_cli" {
default = false
description = "Whether to init the CLI tools kubectl, helm, etc. or not."
default = false
description = "Whether to init kubectl."
}

0 comments on commit 68f2ad5

Please sign in to comment.