Skip to content

Commit

Permalink
Add testframework skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheng Pan committed Oct 16, 2019
1 parent dca43c9 commit ad19387
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ test:

.PHONY: test-e2e
test-e2e:
AWS_REGION=us-west-2 AWS_AVAILABILITY_ZONES=us-west-2a,us-west-2b,us-west-2c ./hack/run-e2e-test
#AWS_REGION=us-west-2 AWS_AVAILABILITY_ZONES=us-west-2a,us-west-2b,us-west-2c ./hack/run-e2e-test
TESTCONFIG=./tester/e2e-test-config.yaml go run tester/cmd/main.go

.PHONY: image
image:
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require (
github.com/container-storage-interface/spec v1.1.0
github.com/golang/mock v1.3.1
github.com/kubernetes-csi/csi-test v2.0.2-0.20190719174114-bc42f92ebdc8+incompatible
github.com/kubernetes-sigs/aws-efs-csi-driver/test/e2e v0.0.0-20191016211840-dca43c9a86ce // indirect
google.golang.org/grpc v1.23.0
k8s.io/klog v0.4.0
k8s.io/kubernetes v1.16.1
Expand Down
2 changes: 2 additions & 0 deletions hack/run-e2e-test
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ sed -i'' "s,newTag: latest,newTag: \"$IMAGE_TAG\"," deploy/kubernetes/overlays/d
kubectl apply -k deploy/kubernetes/overlays/dev/

echo "Creating EFS file system"
date
aws efs create-file-system --creation-token $TEST_ID --tags Key=KubernetesCluster,Value=$CLUSTER_NAME.k8s.local --region $REGION
FILE_SYSTEM_ID=$(aws efs describe-file-systems --creation-token $TEST_ID --region $REGION | jq -r '.FileSystems[0].FileSystemId')

Expand All @@ -93,6 +94,7 @@ for zone in ${ZONES//,/ }; do
SUBNET_ID=$(aws ec2 describe-subnets --filters Name=tag:Name,Values=$SUBNET_NAME --region $REGION | jq -r '.Subnets[0].SubnetId')
aws efs create-mount-target --file-system-id $FILE_SYSTEM_ID --subnet-id $SUBNET_ID --security-groups $GROUP_ID --region $REGION
done
date

# Run the test
export KUBECONFIG=$HOME/.kube/config
Expand Down
25 changes: 25 additions & 0 deletions tester/cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2019 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.
*/

package main

import (
"github.com/aws/aws-k8s-tester/e2e/tester"
)

func main() {
tester.Start()
}
35 changes: 35 additions & 0 deletions tester/e2e-test-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cluster:
kops:
stateFile: s3://k8s-kops-csi-e2e
zones: us-west-2a
nodeCount: 3
nodeSize: c5.large
kubernetesVersion: 1.15.3

build: |
eval $(aws ecr get-login --region us-west-2 --no-include-email)
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IMAGE_TAG={{TEST_ID}}
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/aws-efs-csi-driver
docker build -t $IMAGE_NAME:$IMAGE_TAG .
docker push $IMAGE_NAME:$IMAGE_TAG
install: |
echo "Deploying driver"
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IMAGE_TAG={{TEST_ID}}
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.us-west-2.amazonaws.com/aws-efs-csi-driver
sed -i'' "s,amazon/aws-efs-csi-driver,$IMAGE_NAME," deploy/kubernetes/overlays/dev/kustomization.yaml
sed -i'' "s,newTag: latest,newTag: \"$IMAGE_TAG\"," deploy/kubernetes/overlays/dev/kustomization.yaml
kubectl apply -k deploy/kubernetes/overlays/dev/
uninstall: |
echo "Removing driver"
kubectl delete -k deploy/kubernetes/overlays/dev/
test: |
export KUBECONFIG=$HOME/.kube/config
cluster_name=test-cluster-{{TEST_ID}}.k8s.local
cd tests/e2e
#go test ./ -v -timeout 0 --cluster-name=$cluster_name --region=us-west-2 --report-dir=$ARTIFACTS

0 comments on commit ad19387

Please sign in to comment.