Merge pull request #41239 from vmware/e2eTestsUpdate-v2

Automatic merge from submit-queue (batch tested with PRs 37137, 41506, 41239, 41511, 37953)

e2e test for storage class diskformat verification for vsphere cloud provider

**What this PR does / why we need it**:
This PR adds a new e2e test for vsphere cloud provider.
Test is to verify diskformat specified in storage-class is being honored while volume creation.

Steps:

1. Create StorageClass with diskformat set to valid type (supported options are `eagerzeroedthick`, `zeroedthick` and `thin`)
2. Create PVC which uses the StorageClass created in step 1.
3. Wait for PV to be provisioned.
4. Wait for PVC's status to become Bound
5. Create POD using PVC on specific node.
6. Wait for Disk to be attached to the node.
7. Get node VM's devices and find PV's Volume Disk.
8. Get Backing Info of the Volume Disk and obtain Property of `VirtualDiskFlatVer2BackingInfo` - `EagerlyScrub` and `ThinProvisioned`
9. Based on the value of `EagerlyScrub` and `ThinProvisioned`, verify if diskformat is correct.
10. Delete POD and Wait for Volume Disk to be detached from the Node.
11. Delete PVC, PV and Storage Class



**Which issue this PR fixes** *
fixes #

**Special notes for your reviewer**:
Test is executed against v1.6.0-alpha.1
Test is failing on v1.4.8

**Release Note**
```release-note
NONE
```
@kerneltime @BaluDontu @abrarshivani please review this PR
This commit is contained in:
Kubernetes Submit Queue
2017-02-15 20:05:09 -08:00
committed by GitHub
4 changed files with 328 additions and 13 deletions

View File

@@ -18,6 +18,7 @@ package vsphere
import (
"context"
"github.com/vmware/govmomi"
"os"
"runtime"
"strings"
@@ -25,8 +26,22 @@ import (
// Reads vSphere configuration from system environment and construct vSphere object
func GetVSphere() (*VSphere, error) {
cfg := getVSphereConfig()
client, err := GetgovmomiClient(cfg)
if err != nil {
return nil, err
}
vs := &VSphere{
client: client,
cfg: cfg,
localInstanceID: "",
}
runtime.SetFinalizer(vs, logout)
return vs, nil
}
func getVSphereConfig() *VSphereConfig {
var cfg VSphereConfig
var err error
cfg.Global.VCenterIP = os.Getenv("VSPHERE_VCENTER")
cfg.Global.VCenterPort = os.Getenv("VSPHERE_VCENTER_PORT")
cfg.Global.User = os.Getenv("VSPHERE_USER")
@@ -38,15 +53,13 @@ func GetVSphere() (*VSphere, error) {
if strings.ToLower(os.Getenv("VSPHERE_INSECURE")) == "true" {
cfg.Global.InsecureFlag = true
}
c, err := newClient(context.TODO(), &cfg)
if err != nil {
return nil, err
}
vs := VSphere{
client: c,
cfg: &cfg,
localInstanceID: "",
}
runtime.SetFinalizer(&vs, logout)
return &vs, nil
return &cfg
}
func GetgovmomiClient(cfg *VSphereConfig) (*govmomi.Client, error) {
if cfg == nil {
cfg = getVSphereConfig()
}
client, err := newClient(context.TODO(), cfg)
return client, err
}