From 4a6844e017bf63b8df7dbf3f327309c91da33259 Mon Sep 17 00:00:00 2001 From: Kirsten Schumy Date: Tue, 25 Dec 2018 13:31:25 -0800 Subject: [PATCH] Add var for pr num and flag for vpc with test-integration --- Makefile | 17 +++++++++++++++-- tests/integration/README.md | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2913f189d9..b0cc9c6b24 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,24 @@ GIT_COMMIT?=$(shell git rev-parse HEAD) BUILD_DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") LDFLAGS?="-X ${PKG}/pkg/driver.driverVersion=${VERSION} -X ${PKG}/pkg/driver.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/driver.buildDate=${BUILD_DATE}" -AWS_K8S_TESTER_VERSION?=0.1.9 +# Hard-coded version is needed in case GitHub API rate limit is exceeded. +# TODO: When aws-k8s-tester becomes a full release (https://developer.github.com/v3/repos/releases/#get-the-latest-release), use: +# $(shell curl -s --request GET --url https://api.github.com/repos/aws/aws-k8s-tester/releases/latest | jq -r '.tag_name? // ""') +AWS_K8S_TESTER_VERSION?=$(shell curl -s --request GET --url https://api.github.com/repos/aws/aws-k8s-tester/tags | jq -r '.[0]?.name // "0.1.9"') AWS_K8S_TESTER_OS_ARCH?=$(shell go env GOOS)-amd64 AWS_K8S_TESTER_DOWNLOAD_URL?=https://github.com/aws/aws-k8s-tester/releases/download/${AWS_K8S_TESTER_VERSION}/aws-k8s-tester-${AWS_K8S_TESTER_VERSION}-${AWS_K8S_TESTER_OS_ARCH} AWS_K8S_TESTER_PATH?=/tmp/aws-k8s-tester +VPC_ID_FLAG= +ifdef AWS_K8S_TESTER_VPC_ID + VPC_ID_FLAG=--vpc-id=${AWS_K8S_TESTER_VPC_ID} +endif + +CSI_FLAG=--csi=master +ifdef PULL_NUMBER + CSI_FLAG=--csi=${PULL_NUMBER} +endif + .PHONY: aws-ebs-csi-driver aws-ebs-csi-driver: mkdir -p bin @@ -41,7 +54,7 @@ test-sanity: test-integration: curl -L ${AWS_K8S_TESTER_DOWNLOAD_URL} -o ${AWS_K8S_TESTER_PATH} chmod +x ${AWS_K8S_TESTER_PATH} - aws-k8s-tester csi test integration --terminate-on-exit=true --csi=master --timeout=20m + ${AWS_K8S_TESTER_PATH} csi test integration --terminate-on-exit=true --timeout=20m ${CSI_FLAG} ${VPC_ID_FLAG} .PHONY: test-e2e test-e2e: diff --git a/tests/integration/README.md b/tests/integration/README.md index e279d6069a..f4e2873b38 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -14,6 +14,11 @@ Must satisfy also the requirements for `aws-ebs-csi-driver` make test-integration ``` +#### Overriding Defaults +- The master branch of `aws-ebs-csi-driver` is used by default. To run using a pull request for `aws-ebs-csi-driver`, set `PULL_NUMBER` as an environment variable with a value equal to the pull request number. + +- When the tests are run, a new VPC is created by default. To run using an existing VPC, set `AWS_K8S_TESTER_VPC_ID` as an environment variable with a value equal to an existing VPC ID. + ### Additional Information - GitHub [repo](https://github.com/aws/aws-k8s-tester) for `aws-k8s-tester`, which includes information about releases and running locally