Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reboot vc fix #3051

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/e2e/csi_cns_telemetry_statefulsets.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ var _ = ginkgo.Describe("[csi-block-vanilla] [csi-file-vanilla] [csi-supervisor]
replicas := *(statefulset.Spec.Replicas)
// Waiting for pods status to be Ready.
fss.WaitForStatusReadyReplicas(ctx, client, statefulset, replicas)
gomega.Expect(fss.CheckMount(ctx, client, statefulset, mountPath)).NotTo(gomega.HaveOccurred())
if !windowsEnv {
gomega.Expect(fss.CheckMount(ctx, client, statefulset, mountPath)).NotTo(gomega.HaveOccurred())
}
ssPodsBeforeScaleDown := fss.GetPodList(ctx, client, statefulset)
gomega.Expect(ssPodsBeforeScaleDown.Items).NotTo(gomega.BeEmpty(),
fmt.Sprintf("Unable to get list of Pods from the Statefulset: %v", statefulset.Name))
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/csi_snapshot_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2260,7 +2260,9 @@ var _ = ginkgo.Describe("Volume Snapshot Basic Test", func() {

// Waiting for pods status to be Ready
fss.WaitForStatusReadyReplicas(ctx, client, statefulset, replicas)
gomega.Expect(fss.CheckMount(ctx, client, statefulset, mountPath)).NotTo(gomega.HaveOccurred())
if !windowsEnv {
gomega.Expect(fss.CheckMount(ctx, client, statefulset, mountPath)).NotTo(gomega.HaveOccurred())
}
ssPodsBeforeScaleDown := fss.GetPodList(ctx, client, statefulset)
gomega.Expect(ssPodsBeforeScaleDown.Items).NotTo(gomega.BeEmpty(),
fmt.Sprintf("Unable to get list of Pods from the Statefulset: %v", statefulset.Name))
Expand Down
20 changes: 15 additions & 5 deletions tests/e2e/csi_snapshot_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,15 +649,25 @@ func verifyVolumeRestoreOperation(ctx context.Context, client clientset.Interfac
isDiskAttached, err := e2eVSphere.isVolumeAttachedToVM(client, volHandle2, vmUUID)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect(isDiskAttached).To(gomega.BeTrue(), "Volume is not attached to the node")

var cmd []string
ginkgo.By("Verify the volume is accessible and Read/write is possible")
cmd := []string{"exec", pod.Name, "--namespace=" + namespace, "--", "/bin/sh", "-c",
"cat /mnt/volume1/Pod1.html "}
if windowsEnv {
cmd = []string{"exec", pod.Name, "--namespace=" + namespace, "powershell.exe", "cat /mnt/volume1/Pod1.html"}
} else {
cmd = []string{"exec", pod.Name, "--namespace=" + namespace, "--", "/bin/sh", "-c",
"cat /mnt/volume1/Pod1.html "}
}
output := e2ekubectl.RunKubectlOrDie(namespace, cmd...)
gomega.Expect(strings.Contains(output, "Hello message from Pod1")).NotTo(gomega.BeFalse())

wrtiecmd := []string{"exec", pod.Name, "--namespace=" + namespace, "--", "/bin/sh", "-c",
"echo 'Hello message from test into Pod1' > /mnt/volume1/Pod1.html"}
var wrtiecmd []string
if windowsEnv {
wrtiecmd = []string{"exec", pod.Name, "--namespace=" + namespace, "powershell.exe", "Add-Content /mnt/volume1/Pod1.html 'Hello message from test into Pod1'"}
} else {
wrtiecmd = []string{"exec", pod.Name, "--namespace=" + namespace, "--", "/bin/sh", "-c",
"echo 'Hello message from test into Pod1' > /mnt/volume1/Pod1.html"}
}

e2ekubectl.RunKubectlOrDie(namespace, wrtiecmd...)
output = e2ekubectl.RunKubectlOrDie(namespace, cmd...)
gomega.Expect(strings.Contains(output, "Hello message from test into Pod1")).NotTo(gomega.BeFalse())
Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/csi_static_provisioning_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
gomega.Expect(err).NotTo(gomega.HaveOccurred())
}
if guestCluster {
svcClient, svNamespace := getSvcClientAndNamespace()
setResourceQuota(svcClient, svNamespace, rqLimit)
// Get a config to talk to the apiserver
restConfig := getRestConfigClient()
_, svNamespace := getSvcClientAndNamespace()
setStoragePolicyQuota(ctx, restConfig, storagePolicyName, svNamespace, rqLimit)
}

if os.Getenv(envFullSyncWaitTime) != "" {
Expand Down Expand Up @@ -181,7 +183,6 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {

if guestCluster {
svcClient, svNamespace := getSvcClientAndNamespace()
setResourceQuota(svcClient, svNamespace, defaultrqLimit)
dumpSvcNsEventsOnTestFailure(svcClient, svNamespace)
}
if supervisorCluster {
Expand Down Expand Up @@ -212,7 +213,8 @@ var _ = ginkgo.Describe("Basic Static Provisioning", func() {
framework.Logf("storageclass name :%s", storageclass.GetName())

ginkgo.By("create resource quota")
setStoragePolicyQuota(ctx, restConfig, storagePolicyName, namespace, rqLimit)
// setStoragePolicyQuota(ctx, restConfig, storagePolicyName, namespace, rqLimit)
createResourceQuota(client, namespace, rqLimit, storagePolicyName)

return restConfig, storageclass, profileID
}
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/e2e_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ const (
fullSyncFss = "trigger-csi-fullsync"
gcNodeUser = "vmware-system-user"
gcKubeConfigPath = "GC_KUBE_CONFIG"
gcSshKey = "TEST-CLUSTER-SSH-KEY"
healthGreen = "green"
healthRed = "red"
healthStatusAccessible = "accessible"
healthStatusInAccessible = "inaccessible"
healthStatusWaitTime = 2 * time.Minute
healthStatusWaitTime = 3 * time.Minute
hostdServiceName = "hostd"
invalidFSType = "ext10"
k8sPodTerminationTimeOut = 7 * time.Minute
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/fullsync_test_for_block_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ var _ bool = ginkgo.Describe("full-sync-test", func() {

// TODO: Replace static wait with polling
ginkgo.By(fmt.Sprintf("Sleeping for %v seconds to allow vsan-health to completely shutdown",
vsanHealthServiceWaitTime))
time.Sleep(time.Duration(vsanHealthServiceWaitTime) * time.Second)
oneMinuteWaitTimeInSeconds))
time.Sleep(time.Duration(oneMinuteWaitTimeInSeconds) * time.Second)

ginkgo.By("when vsan-health is stopped, delete pod1")
err = fpod.DeletePodWithWait(ctx, client, pod)
Expand Down Expand Up @@ -910,6 +910,7 @@ var _ bool = ginkgo.Describe("full-sync-test", func() {

ginkgo.By(fmt.Sprintf("Waiting for CNS volume %s to be deleted", volHandle))
err = e2eVSphere.waitForCNSVolumeToBeDeleted(volHandle)

gomega.Expect(err).NotTo(gomega.HaveOccurred())

})
Expand Down
75 changes: 59 additions & 16 deletions tests/e2e/gc_block_resize_retain_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
storagePolicyName = GetAndExpectStringEnvVar(envStoragePolicyNameForSharedDatastores)

scParameters := make(map[string]string)
scParameters[scParamFsType] = ext4FSType
if windowsEnv {
scParameters[scParamFsType] = ntfsFSType
} else {
scParameters[scParamFsType] = ext4FSType
}
// Set resource quota.
ginkgo.By("Set Resource quota for GC")
svcClient, svNamespace := getSvcClientAndNamespace()
Expand Down Expand Up @@ -122,8 +126,11 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
pvDeleted = false

// Replace second element with pod.Name.
cmd = []string{"exec", "", fmt.Sprintf("--namespace=%v", namespace),
"--", "/bin/sh", "-c", "df -Tkm | grep /mnt/volume1"}
if windowsEnv {
cmd = []string{"exec", "", "--namespace=" + namespace, "powershell.exe", "cat", "/mnt/volume1/fstype.txt"}
} else {
cmd = []string{"exec", "", "--namespace=" + namespace, "--", "/bin/sh", "-c", "df -Tkm | grep /mnt/volume1"}
}

// Set up default pandora sync wait time.
pandoraSyncWaitTime = defaultPandoraSyncWaitTime
Expand Down Expand Up @@ -219,10 +226,15 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
ginkgo.By("Verify the volume is accessible and filesystem type is as expected")
cmd[1] = pod.Name
lastOutput := e2ekubectl.RunKubectlOrDie(namespace, cmd...)
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
if windowsEnv {
gomega.Expect(strings.Contains(lastOutput, ntfsFSType)).NotTo(gomega.BeFalse())
} else {
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
}

ginkgo.By("Check filesystem size for mount point /mnt/volume1 before expansion")
originalFsSize, err := getFSSizeMb(f, pod)
// originalFsSize, err := getFSSizeMb(f, pod)
originalFsSize, err := getFileSystemSizeForOsType(f, client, pod)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// Delete POD.
Expand Down Expand Up @@ -337,7 +349,11 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
ginkgo.By("Verify after expansion the filesystem type is as expected")
cmd[1] = pod.Name
lastOutput = e2ekubectl.RunKubectlOrDie(namespace, cmd...)
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
if windowsEnv {
gomega.Expect(strings.Contains(lastOutput, ntfsFSType)).NotTo(gomega.BeFalse())
} else {
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
}

ginkgo.By("Waiting for file system resize to finish")
pvclaim, err = waitForFSResize(pvclaim, client)
Expand All @@ -347,7 +363,8 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
expectEqual(len(pvcConditions), 0, "pvc should not have conditions")

ginkgo.By("Verify filesystem size for mount point /mnt/volume1 after expansion")
fsSize, err := getFSSizeMb(f, pod)
// fsSize, err := getFSSizeMb(f, pod)
fsSize, err := getFileSystemSizeForOsType(f, client, pod)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Filesystem size may be smaller than the size of the block volume.
// Here since filesystem was already formatted on the original volume,
Expand Down Expand Up @@ -435,7 +452,11 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
_ = getPVCFromSupervisorCluster(svcPVCName)

scParameters := make(map[string]string)
scParameters[scParamFsType] = ext4FSType
if windowsEnv {
scParameters[scParamFsType] = ntfsFSType
} else {
scParameters[scParamFsType] = ext4FSType
}
scParameters[svStorageClassName] = storagePolicyName
storageclassNewGC, err := createStorageClass(clientNewGc,
scParameters, nil, v1.PersistentVolumeReclaimDelete, "", true, "")
Expand Down Expand Up @@ -468,7 +489,12 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
gomega.Expect(volumeID).NotTo(gomega.BeEmpty())

ginkgo.By("Creating the PV")
pvNew := getPersistentVolumeSpec(svcPVCName, v1.PersistentVolumeReclaimDelete, nil, ext4FSType)
var pvNew *v1.PersistentVolume
if windowsEnv {
pvNew = getPersistentVolumeSpec(svcPVCName, v1.PersistentVolumeReclaimDelete, nil, ntfsFSType)
} else {
pvNew = getPersistentVolumeSpec(svcPVCName, v1.PersistentVolumeReclaimDelete, nil, ext4FSType)
}
pvNew.Annotations = pvtemp.Annotations
pvNew.Spec.StorageClassName = pvtemp.Spec.StorageClassName
pvNew.Spec.CSI = pvtemp.Spec.CSI
Expand Down Expand Up @@ -557,10 +583,17 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
framework.TestContext.KubeConfig = oldKubeConfig
}()

cmd2 = []string{"exec", pod.Name, fmt.Sprintf("--namespace=%v", namespaceNewGC),
"--", "/bin/sh", "-c", "df -Tkm | grep /mnt/volume1"}
if windowsEnv {
cmd2 = []string{"exec", pod.Name, "--namespace=" + namespace, "powershell.exe", "cat", "/mnt/volume1/fstype.txt"}
} else {
cmd2 = []string{"exec", pod.Name, "--namespace=" + namespace, "--", "/bin/sh", "-c", "df -Tkm | grep /mnt/volume1"}
}
lastOutput := e2ekubectl.RunKubectlOrDie(namespaceNewGC, cmd2...)
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
if windowsEnv {
gomega.Expect(strings.Contains(lastOutput, ntfsFSType)).NotTo(gomega.BeFalse())
} else {
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
}

ginkgo.By("Waiting for file system resize to finish")
pvcNew, err = waitForFSResize(pvcNew, clientNewGc)
Expand Down Expand Up @@ -676,10 +709,15 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
ginkgo.By("Verify the volume is accessible and filesystem type is as expected")
cmd[1] = pod.Name
lastOutput := e2ekubectl.RunKubectlOrDie(namespace, cmd...)
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
if windowsEnv {
gomega.Expect(strings.Contains(lastOutput, ntfsFSType)).NotTo(gomega.BeFalse())
} else {
gomega.Expect(strings.Contains(lastOutput, ext4FSType)).NotTo(gomega.BeFalse())
}

ginkgo.By("Check filesystem size for mount point /mnt/volume1 before expansion")
originalFsSize, err := getFSSizeMb(f, pod)
// originalFsSize, err := getFSSizeMb(f, pod)
originalFsSize, err := getFileSystemSizeForOsType(f, client, pod)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

defer func() {
Expand Down Expand Up @@ -743,7 +781,8 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
expectEqual(len(pvcConditions), 0, "pvc should not have conditions")

ginkgo.By("Verify filesystem size for mount point /mnt/volume1 after expansion")
fsSize, err := getFSSizeMb(f, pod)
// fsSize, err := getFSSizeMb(f, pod)
fsSize, err := getFileSystemSizeForOsType(f, client, pod)
gomega.Expect(err).NotTo(gomega.HaveOccurred())
// Filesystem size may be smaller than the size of the block volume.
// Here since filesystem was already formatted on the original volume,
Expand Down Expand Up @@ -884,7 +923,11 @@ var _ = ginkgo.Describe("[csi-guest] Volume Expansion Tests with reclaimation po
isGC2PVCreated = false

scParameters := make(map[string]string)
scParameters[scParamFsType] = ext4FSType
if windowsEnv {
scParameters[scParamFsType] = ntfsFSType
} else {
scParameters[scParamFsType] = ext4FSType
}
scParameters[svStorageClassName] = storagePolicyName
storageclassInGC1, err := createStorageClass(client,
scParameters, nil, v1.PersistentVolumeReclaimDelete, "", true, "")
Expand Down
Loading