-
Notifications
You must be signed in to change notification settings - Fork 807
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first e2e test case client-go as test dependency
The test case automates the steps: 1. create storageclass, pvc 2. create pod 3. make sure the pod is running (this means the volume is mounted successfully)
- Loading branch information
Cheng Pan
committed
Dec 5, 2018
1 parent
9a17b67
commit 2728c92
Showing
968 changed files
with
335,536 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/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. | ||
|
||
set -euo pipefail | ||
|
||
go test ./tests/e2e/... -ginkgo.v -v | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/kubernetes-sigs/aws-ebs-csi-driver/tests/utils" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var ( | ||
testDataDir = "testdata/dynamic_provisioning" | ||
kubeconfig = filepath.Join(os.Getenv("HOME"), ".kube/config") | ||
namespace = "default" | ||
) | ||
|
||
var _ = Describe("Dynamic Provisioning", func() { | ||
|
||
It("should create a volume on demand", func() { | ||
var ( | ||
claimSpec = filepath.Join(testDataDir, "claim.yaml") | ||
storageclassSpec = filepath.Join(testDataDir, "storageclass.yaml") | ||
podSpec = filepath.Join(testDataDir, "pod.yaml") | ||
) | ||
kk, err := utils.NewKubectl(kubeconfig) | ||
Expect(err).To(BeNil()) | ||
|
||
logf("Creating StorageClass: %v", storageclassSpec) | ||
err = kk.Create(storageclassSpec) | ||
Expect(err).To(BeNil()) | ||
defer func() { | ||
logf("Deleting StorageClass: %v", storageclassSpec) | ||
err = kk.Delete(storageclassSpec) | ||
Expect(err).To(BeNil()) | ||
}() | ||
|
||
logf("Creating PVC: %v", claimSpec) | ||
err = kk.Create(claimSpec) | ||
Expect(err).To(BeNil()) | ||
defer func() { | ||
logf("Deleting PVC: %v", claimSpec) | ||
err = kk.Delete(claimSpec) | ||
Expect(err).To(BeNil()) | ||
}() | ||
|
||
logf("Creating Pod: %v", podSpec) | ||
err = kk.Create(podSpec) | ||
Expect(err).To(BeNil()) | ||
defer func() { | ||
logf("Deleting Pod: %v", podSpec) | ||
err = kk.Delete(podSpec) | ||
Expect(err).To(BeNil()) | ||
}() | ||
|
||
// ensure pod is ready | ||
err = kk.EnsurePodRunning(podSpec) | ||
Expect(err).To(BeNil()) | ||
logf("Pod is running") | ||
}) | ||
}) | ||
|
||
func logf(format string, args ...interface{}) { | ||
fmt.Fprintln(GinkgoWriter, fmt.Sprintf(format, args...)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestE2E(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "AWS EBS CSI Driver End-to-End Tests") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: test-claim | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: test-sc | ||
resources: | ||
requests: | ||
storage: 4Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: test-app | ||
spec: | ||
containers: | ||
- name: app | ||
image: centos | ||
command: ["/bin/sh"] | ||
args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"] | ||
volumeMounts: | ||
- name: persistent-storage | ||
mountPath: /data | ||
volumes: | ||
- name: persistent-storage | ||
persistentVolumeClaim: | ||
claimName: test-claim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1 | ||
metadata: | ||
name: test-sc | ||
provisioner: ebs.csi.aws.com |
Oops, something went wrong.