Skip to content

Commit

Permalink
Merge pull request #267 from leakingtapan/integration-test
Browse files Browse the repository at this point in the history
Refactor integration test script
  • Loading branch information
k8s-ci-robot committed Apr 5, 2019
2 parents 5ac22b7 + a91e448 commit 6235a2a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
22 changes: 1 addition & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,8 @@ 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} -s -w"
GO111MODULE=on

# 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? // "<current version number>"')
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.2.5"')
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

.EXPORT_ALL_VARIABLES:

VPC_ID_FLAG=
ifdef AWS_K8S_TESTER_VPC_ID
VPC_ID_FLAG=--vpc-id=${AWS_K8S_TESTER_VPC_ID}
endif

PR_NUM_FLAG=
ifdef PULL_NUMBER
PR_NUM_FLAG=--pr-num=${PULL_NUMBER}
endif

.PHONY: aws-ebs-csi-driver
aws-ebs-csi-driver:
mkdir -p bin
Expand All @@ -59,9 +41,7 @@ test-sanity:

.PHONY: test-integration
test-integration:
curl -L ${AWS_K8S_TESTER_DOWNLOAD_URL} -o ${AWS_K8S_TESTER_PATH}
chmod +x ${AWS_K8S_TESTER_PATH}
${AWS_K8S_TESTER_PATH} csi test integration --terminate-on-exit=true --timeout=20m ${PR_NUM_FLAG} ${VPC_ID_FLAG}
./hack/run-integration-test

.PHONY: test-e2e-single-az
test-e2e-single-az:
Expand Down
37 changes: 37 additions & 0 deletions hack/run-integration-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# 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? // "<current version number>"')
AWS_K8S_TESTER_VERSION=$(curl -s --request GET --url https://api.github.com/repos/aws/aws-k8s-tester/tags | jq -r '.[0]?.name // "0.2.5"')
AWS_K8S_TESTER_OS_ARCH=$(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=""
if [ -z "$AWS_K8S_TESTER_VPC_ID" ]; then
VPC_ID_FLAG=--vpc-id=${AWS_K8S_TESTER_VPC_ID}
fi

PR_NUM_FLAG=""
if [ -z "$PULL_NUMBER" ]; then
PR_NUM_FLAG=--pr-num=${PULL_NUMBER}
fi

curl -L ${AWS_K8S_TESTER_DOWNLOAD_URL} -o ${AWS_K8S_TESTER_PATH}
chmod +x ${AWS_K8S_TESTER_PATH}
${AWS_K8S_TESTER_PATH} csi test integration --terminate-on-exit=true --timeout=20m ${PR_NUM_FLAG} ${VPC_ID_FLAG}

0 comments on commit 6235a2a

Please sign in to comment.