From e71d38aead677b7efee2d180cb37b565fed659b8 Mon Sep 17 00:00:00 2001 From: pshahzeb Date: Tue, 10 Oct 2017 17:27:53 -0700 Subject: [PATCH] Tests to verify volume provisioning on a clustered datastore --- test/e2e/storage/BUILD | 1 + test/e2e/storage/vsphere_volume_cluster_ds.go | 137 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 test/e2e/storage/vsphere_volume_cluster_ds.go diff --git a/test/e2e/storage/BUILD b/test/e2e/storage/BUILD index 18e20ddb979..0a6fe6fbafc 100644 --- a/test/e2e/storage/BUILD +++ b/test/e2e/storage/BUILD @@ -24,6 +24,7 @@ go_library( "volume_provisioning.go", "volumes.go", "vsphere_utils.go", + "vsphere_volume_cluster_ds.go", "vsphere_volume_diskformat.go", "vsphere_volume_fstype.go", "vsphere_volume_ops_storm.go", diff --git a/test/e2e/storage/vsphere_volume_cluster_ds.go b/test/e2e/storage/vsphere_volume_cluster_ds.go new file mode 100644 index 00000000000..75ef426f650 --- /dev/null +++ b/test/e2e/storage/vsphere_volume_cluster_ds.go @@ -0,0 +1,137 @@ +/* +Copyright 2017 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 storage + +import ( + "fmt" + "os" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" + clientset "k8s.io/client-go/kubernetes" + "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" + "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib" + "k8s.io/kubernetes/test/e2e/framework" +) + +/* + Tests to verify volume provisioning on a clustered datastore + 1. Static provisioning + 2. Dynamic provisioning + 3. Dynamic provisioning with spbm policy + + This test reads env + 1. CLUSTER_DATASTORE which should be set to clustered datastore + 2. VSPHERE_SPBM_POLICY_DS_CLUSTER which should be set to a tag based spbm policy tagged to a clustered datastore +*/ +var _ = SIGDescribe("Volume Provisioning On Clustered Datastore [Feature:vsphere]", func() { + f := framework.NewDefaultFramework("volume-provision") + + var client clientset.Interface + var namespace string + var scParameters map[string]string + var clusterDatastore string + BeforeEach(func() { + framework.SkipUnlessProviderIs("vsphere") + client = f.ClientSet + namespace = f.Namespace.Name + scParameters = make(map[string]string) + + clusterDatastore = os.Getenv("CLUSTER_DATASTORE") + Expect(clusterDatastore).NotTo(BeEmpty(), "Please set CLUSTER_DATASTORE system environment. eg: export CLUSTER_DATASTORE=/