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 17, 2019
1 parent dca43c9 commit c63ec4a
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 472 deletions.
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
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
module github.com/kubernetes-sigs/aws-efs-csi-driver

require (
github.com/aws/aws-k8s-tester/e2e/tester v0.0.0-20191012181850-1ee05aff3c62
github.com/aws/aws-sdk-go v1.23.21
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/onsi/ginkgo v1.8.0
github.com/onsi/gomega v1.5.0
google.golang.org/grpc v1.23.0
k8s.io/api v0.0.0
k8s.io/apimachinery v0.0.0
k8s.io/klog v0.4.0
k8s.io/kubernetes v1.16.1
)
Expand Down
170 changes: 170 additions & 0 deletions go.sum

Large diffs are not rendered by default.

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
20 changes: 19 additions & 1 deletion test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"log"
"os"
"path"
"path/filepath"
"testing"

"github.com/onsi/ginkgo"
Expand All @@ -32,15 +33,32 @@ import (
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework/testfiles"
frameworkconfig "k8s.io/kubernetes/test/e2e/framework/config"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
)

const kubeconfigEnvVar = "KUBECONFIG"

var clusterName = flag.String("cluster-name", "", "the cluster name")
var region = flag.String("region", "us-west-2", "the region")

func init() {
framework.HandleFlags()
// k8s.io/kubernetes/test/e2e/framework requires env KUBECONFIG to be set
// it does not fall back to defaults
if os.Getenv(kubeconfigEnvVar) == "" {
kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
os.Setenv(kubeconfigEnvVar, kubeconfig)
}

framework.AfterReadingAllFlags(&framework.TestContext)
// PWD is test/e2e inside the git repo
testfiles.AddFileSource(testfiles.RootFileSource{Root: "../.."})

frameworkconfig.CopyFlags(frameworkconfig.Flags, flag.CommandLine)
framework.RegisterCommonFlags(flag.CommandLine)
framework.RegisterClusterFlags(flag.CommandLine)
flag.Parse()
}

var fileSystemID = flag.String("file-system-id", "", "required. file system ID of the EFS file system to use for the test")
Expand Down
59 changes: 0 additions & 59 deletions test/e2e/go.mod

This file was deleted.

Loading

0 comments on commit c63ec4a

Please sign in to comment.