Skip to content

Commit

Permalink
Merge pull request #726 from AndyXiangLi/external-e2e-test
Browse files Browse the repository at this point in the history
Integrate external e2e test in the testsuits
  • Loading branch information
wongma7 authored Feb 5, 2021
2 parents 9dbb610 + 6d2e79c commit 0d9e88b
Show file tree
Hide file tree
Showing 11 changed files with 514 additions and 17 deletions.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,20 @@ test-e2e-multi-az:
test-e2e-migration:
AWS_REGION=us-west-2 \
AWS_AVAILABILITY_ZONES=us-west-2a \
TEST_PATH=./tests/e2e-migration/... \
TEST_PATH=./tests/e2e-kubernetes/... \
GINKGO_FOCUS="\[ebs-csi-migration\]" \
EBS_CHECK_MIGRATION=true \
./hack/e2e/run.sh

.PHONY: test-e2e-external
test-e2e-external:
AWS_REGION=us-west-2 \
AWS_AVAILABILITY_ZONES=us-west-2a \
TEST_PATH=./tests/e2e-kubernetes/... \
GINKGO_FOCUS="External.Storage" \
GINKGO_SKIP="\[Disruptive\]|\[Serial\]" \
./hack/e2e/run.sh

.PHONY: image-release
image-release:
docker build -t $(IMAGE):$(VERSION) . --target debian-base
Expand Down
17 changes: 17 additions & 0 deletions tests/e2e-kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Kubernetes tests

This directory imports tests from kubernetes/kubernetes and enables:

* External CSI tests, https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external
* CSI migration tests

# Prerequisites
- kubernetes 1.17+ AWS cluster

# Run
* External CSI tests: `FOCUS=External.Storage`.
* CSI migration tests: `FOCUS=[ebs-csi-migration]`.

```sh
go test -v -timeout 0 ./... -kubeconfig=$HOME/.kube/config -report-dir=$ARTIFACTS -ginkgo.focus="$FOCUS" -ginkgo.skip="\[Disruptive\]" -gce-zone=us-west-2a
```
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ package e2e
import (
"flag"
"fmt"
"k8s.io/kubernetes/test/e2e/framework/testfiles"
"k8s.io/kubernetes/test/e2e/storage/drivers"
"k8s.io/kubernetes/test/e2e/storage/external"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"log"
"math/rand"
"os"
Expand All @@ -30,9 +34,6 @@ import (
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/drivers"
"k8s.io/kubernetes/test/e2e/storage/testsuites"

// ensure that cloud provider is loaded
_ "k8s.io/kubernetes/test/e2e/framework/providers/aws"
)
Expand All @@ -54,6 +55,10 @@ func init() {
_ = flag.Set("provider", "aws")
flag.Parse()
framework.AfterReadingAllFlags(&framework.TestContext)

// Add e2e tests for the CSI driver (without migration)
testfiles.AddFileSource(testfiles.RootFileSource{Root: "."})
external.AddDriverDefinition("manifests.yaml")
}

func TestEBSCSI(t *testing.T) {
Expand Down
29 changes: 29 additions & 0 deletions tests/e2e-kubernetes/manifests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Manifest for Kubernetes external tests.
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external

ShortName: ebs
StorageClass:
FromFile: storageclass.yaml
SnapshotClass:
FromFile: snapshotclass.yaml
DriverInfo:
Name: ebs.csi.aws.com
SupportedSizeRange:
Min: 1Gi
Max: 16Ti
SupportedFsType:
xfs: {}
ext4: {}
SupportedMountOption:
dirsync: {}
TopologyKeys: ["topology.ebs.csi.aws.com/zone"]
Capabilities:
persistence: true
fsGroup: true
block: true
exec: true
volumeLimits: false
controllerExpansion: true
nodeExpansion: true
snapshotDataSource: true
multipods: true
9 changes: 9 additions & 0 deletions tests/e2e-kubernetes/snapshotclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SnapshotClass for Kubernetes external tests.
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external

apiVersion: snapshot.storage.k8s.io/v1beta1
kind: VolumeSnapshotClass
metadata:
name: csi-aws-vsc
driver: ebs.csi.aws.com
deletionPolicy: Delete
9 changes: 9 additions & 0 deletions tests/e2e-kubernetes/storageclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# StorageClass for Kubernetes external tests.
# See https://github.com/kubernetes/kubernetes/tree/master/test/e2e/storage/external

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: ebs.csi.aws.com
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
13 changes: 0 additions & 13 deletions tests/e2e-migration/README.md

This file was deleted.

53 changes: 53 additions & 0 deletions vendor/k8s.io/kubernetes/test/e2e/storage/external/BUILD

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions vendor/k8s.io/kubernetes/test/e2e/storage/external/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0d9e88b

Please sign in to comment.