Skip to content

Commit

Permalink
Update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
jsafrane committed Jul 15, 2016
1 parent be14d99 commit c28e599
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion test/e2e/volume_provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/e2e/framework"

Expand Down Expand Up @@ -52,6 +53,11 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
framework.KubeDescribe("DynamicProvisioner", func() {
It("should create and delete persistent volumes", func() {
framework.SkipUnlessProviderIs("openstack", "gce", "aws", "gke")

By("creating a claim with a dynamic provisioning annotation")
class := createStorageClass()
defer c.Extensions().StorageClasses().Delete(class.Name)

By("creating a claim with a dynamic provisioning annotation")
claim := createClaim(ns)
defer func() {
Expand Down Expand Up @@ -130,7 +136,7 @@ func createClaim(ns string) *api.PersistentVolumeClaim {
GenerateName: "pvc-",
Namespace: ns,
Annotations: map[string]string{
"volume.alpha.kubernetes.io/storage-class": "",
"volume.alpha.kubernetes.io/storage-class": "gold",
},
},
Spec: api.PersistentVolumeClaimSpec{
Expand Down Expand Up @@ -192,3 +198,26 @@ func runInPodWithVolume(c *client.Client, ns, claimName, command string) {
framework.ExpectNoError(err, "Failed to create pod: %v", err)
framework.ExpectNoError(framework.WaitForPodSuccessInNamespaceSlow(c, pod.Name, pod.Spec.Containers[0].Name, pod.Namespace))
}

func createStorageClass() *extensions.StorageClass {
var pluginName string

switch {
case framework.ProviderIs("gke"), framework.ProviderIs("gce"):
pluginName = "kubernetes.io/gce-pd"
case framework.ProviderIs("aws"):
pluginName = "kubernetes.io/aws-ebs"
case framework.ProviderIs("openstack"):
pluginName = "kubernetes.io/cinder"
}

return &extensions.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
ObjectMeta: api.ObjectMeta{
Name: "gold",
},
ProvisionerType: pluginName,
}
}

0 comments on commit c28e599

Please sign in to comment.