Acceptance Tests (EKS) #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Acceptance Tests (EKS) | |
on: | |
workflow_dispatch: | |
inputs: | |
region: | |
description: The AWS region | |
default: ca-central-1 | |
azSpan: | |
description: The number of AZs to spread cluster nodes across | |
default: 2 | |
clusterVersion: | |
description: The EKS cluster version | |
default: 1.27 | |
nodesPerAz: | |
description: The number of cluster nodes in each AZ | |
default: 1 | |
instanceType: | |
description: The type of EC2 instance to use for cluster nodes | |
default: m7g.large | |
parallelRuns: | |
description: The maximum number of tests to run simultaneously | |
default: 8 | |
runTests: | |
description: The regex passed to the -run option of `go test` | |
default: "^TestAcc" | |
terraformVersion: | |
description: Terraform version | |
default: 1.7.5 | |
schedule: | |
- cron: '0 20 * * *' | |
env: | |
AWS_REGION: ${{ github.event.inputs.region || vars.AWS_REGION }} | |
KUBE_CONFIG_PATH: ${{ github.workspace }}/kubernetes/test-infra/eks/kubeconfig | |
PARALLEL_RUNS: ${{ github.event.inputs.parallelRuns || vars.PARALLEL_RUNS }} | |
TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || vars.TERRAFORM_VERSION }} | |
TF_VAR_az_span: ${{ github.event.inputs.azSpan || vars.AWS_AZ_NUMBER }} | |
TF_VAR_capacity_type: ${{ vars.AWS_CAPACITY_TYPE }} | |
TF_VAR_cluster_version: ${{ github.event.inputs.clusterVersion || vars.CLUSTER_VERSION }} | |
TF_VAR_nodes_per_az: ${{ github.event.inputs.nodesPerAz || vars.AWS_NODES_PER_AZ }} | |
TF_VAR_instance_type: ${{ github.event.inputs.instanceType || vars.AWS_INSTANCE_TYPE }} | |
jobs: | |
acceptance_tests_eks: | |
if: ${{ github.repository_owner == 'hashicorp' }} | |
runs-on: custom-linux-medium | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Set up Go | |
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version-file: 'go.mod' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} | |
role-session-name: github-actions-tests-${{ github.run_number }} | |
role-duration-seconds: 14400 | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
terraform_wrapper: false | |
- name: Provision EKS Cluster | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/eks | |
run: | | |
terraform init | |
terraform apply -auto-approve | |
- name: Install AWS EBS CSI Driver | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/aws-ebs-csi-driver | |
run: | | |
terraform init | |
terraform apply -auto-approve | |
- name: Run Acceptance Test Suite | |
env: | |
TESTARGS: -run ${{ github.event.inputs.runTests || '^TestAcc' }} | |
# Do not set TF_ACC_TERRAFORM_PATH or TF_ACC_TERRAFORM_VERSION. | |
# In this case, the framework will search for the Terraform CLI binary based on the operating system PATH. | |
# Eventually, it will use the one we set up. | |
# More information: https://developer.hashicorp.com/terraform/plugin/sdkv2/testing/acceptance-tests#terraform-cli-installation-behaviors | |
run: | | |
make testacc | |
- name: Destroy EKS cluster | |
if: always() # we should destroy the cluster even if the tests fail | |
working-directory: ${{ github.workspace }}/kubernetes/test-infra/eks | |
run: | | |
terraform destroy -auto-approve |