Skip to content

Commit 3551697

Browse files
Fixed e2e for CSI snapshot
1 parent ef5156e commit 3551697

File tree

2 files changed

+82
-83
lines changed

2 files changed

+82
-83
lines changed

test/e2e/cloud-provider-oci/csi_snapshot_restore.go

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -39,88 +39,88 @@ const (
3939
var _ = Describe("Snapshot Creation and Restore", func() {
4040
f := framework.NewBackupFramework("snapshot-restore")
4141

42-
Context("[cloudprovider][storage][csi][snapshot][restore][test1]", func() {
43-
//tests := []struct{
44-
// attachmentType string
45-
// backupType string
46-
// fsType string
47-
//}{
48-
// {framework.AttachmentTypeParavirtualized, framework.BackupTypeIncremental, ""},
49-
// {framework.AttachmentTypeParavirtualized, framework.BackupTypeFull, ""},
50-
// {framework.AttachmentTypeISCSI, framework.BackupTypeIncremental, ""},
51-
// {framework.AttachmentTypeISCSI, framework.BackupTypeFull, ""},
52-
// {framework.AttachmentTypeISCSI, framework.BackupTypeIncremental, "xfs"},
53-
// {framework.AttachmentTypeParavirtualized, framework.BackupTypeFull, "ext3"},
54-
//}
55-
//for _, entry := range tests {
56-
// entry := entry
57-
// testName := "Should be able to create and restore " + entry.backupType + " snapshot from " + entry.attachmentType + " volume "
58-
// if entry.fsType != "" {
59-
// testName += " with " + entry.fsType + " fsType"
60-
// }
61-
// It(testName, func() {
62-
// scParams := map[string]string{framework.AttachmentType: entry.attachmentType}
63-
// vscParams := map[string]string{framework.BackupType: entry.backupType}
64-
// scParams[framework.FstypeKey] = entry.fsType
65-
// testSnapshotAndRestore(f, scParams, vscParams)
66-
// })
67-
//}
68-
//It("FS should get expanded when a PVC is restored with a lesser size backup (iscsi)", func() {
69-
// checkOrInstallCRDs(f)
70-
// scParams := map[string]string{framework.AttachmentType: framework.AttachmentTypeISCSI}
71-
// vscParams := map[string]string{framework.BackupType: framework.BackupTypeFull}
72-
// pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-snapshot-restore-e2e-tests")
73-
// pvcJig.InitialiseSnapClient(f.SnapClientSet)
74-
//
75-
// scName := f.CreateStorageClassOrFail(f.Namespace.Name, BVDriverName, scParams, pvcJig.Labels, BindingModeWaitForFirstConsumer, true, ReclaimPolicyDelete, nil)
76-
// pvc := pvcJig.CreateAndAwaitPVCOrFailCSI(f.Namespace.Name, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
77-
//
78-
// _ = pvcJig.NewPodForCSI("pod-original", f.Namespace.Name, pvc.Name, setupF.AdLabel)
79-
//
80-
// time.Sleep(60 * time.Second) //waiting for pod to up and running
81-
//
82-
// vscName := f.CreateVolumeSnapshotClassOrFail(f.Namespace.Name, BVDriverName, vscParams, ReclaimPolicyDelete)
83-
// vs := pvcJig.CreateAndAwaitVolumeSnapshotOrFail(f.Namespace.Name, vscName, pvc.Name, nil)
84-
//
85-
// pvcRestore := pvcJig.CreateAndAwaitPVCOrFailSnapshotSource(f.Namespace.Name, framework.MaxVolumeBlock, scName, vs.Name, v1.ClaimPending, nil)
86-
// podRestoreName := pvcJig.NewPodForCSI("pod-restored", f.Namespace.Name, pvcRestore.Name, setupF.AdLabel)
87-
//
88-
// time.Sleep(60 * time.Second) //waiting for pod to up and running
89-
//
90-
// pvcJig.CheckUsableVolumeSizeInsidePod(f.Namespace.Name, podRestoreName, "99G")
91-
//
92-
// f.VolumeIds = append(f.VolumeIds, pvc.Spec.VolumeName)
93-
// _ = f.DeleteVolumeSnapshotClass(f.Namespace.Name)
94-
// _ = f.DeleteStorageClass(f.Namespace.Name)
95-
//})
96-
//It("FS should get expanded when a PVC is restored with a lesser size backup (paravirtualized)", func() {
97-
// checkOrInstallCRDs(f)
98-
// scParams := map[string]string{framework.AttachmentType: framework.AttachmentTypeParavirtualized}
99-
// vscParams := map[string]string{framework.BackupType: framework.BackupTypeFull}
100-
// pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-snapshot-restore-e2e-tests")
101-
// pvcJig.InitialiseSnapClient(f.SnapClientSet)
102-
//
103-
// scName := f.CreateStorageClassOrFail(f.Namespace.Name, BVDriverName, scParams, pvcJig.Labels, BindingModeWaitForFirstConsumer, true, ReclaimPolicyDelete, nil)
104-
// pvc := pvcJig.CreateAndAwaitPVCOrFailCSI(f.Namespace.Name, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
105-
//
106-
// _ = pvcJig.NewPodForCSI("pod-original", f.Namespace.Name, pvc.Name, setupF.AdLabel)
107-
//
108-
// time.Sleep(60 * time.Second) //waiting for pod to up and running
109-
//
110-
// vscName := f.CreateVolumeSnapshotClassOrFail(f.Namespace.Name, BVDriverName, vscParams, ReclaimPolicyDelete)
111-
// vs := pvcJig.CreateAndAwaitVolumeSnapshotOrFail(f.Namespace.Name, vscName, pvc.Name, nil)
112-
//
113-
// pvcRestore := pvcJig.CreateAndAwaitPVCOrFailSnapshotSource(f.Namespace.Name, framework.MaxVolumeBlock, scName, vs.Name, v1.ClaimPending, nil)
114-
// podRestoreName := pvcJig.NewPodForCSI("pod-restored", f.Namespace.Name, pvcRestore.Name, setupF.AdLabel)
115-
//
116-
// time.Sleep(60 * time.Second) //waiting for pod to up and running
117-
//
118-
// pvcJig.CheckUsableVolumeSizeInsidePod(f.Namespace.Name, podRestoreName, "99G")
119-
//
120-
// f.VolumeIds = append(f.VolumeIds, pvc.Spec.VolumeName)
121-
// _ = f.DeleteVolumeSnapshotClass(f.Namespace.Name)
122-
// _ = f.DeleteStorageClass(f.Namespace.Name)
123-
//})
42+
Context("[cloudprovider][storage][csi][snapshot][restore]", func() {
43+
tests := []struct{
44+
attachmentType string
45+
backupType string
46+
fsType string
47+
}{
48+
{framework.AttachmentTypeParavirtualized, framework.BackupTypeIncremental, ""},
49+
{framework.AttachmentTypeParavirtualized, framework.BackupTypeFull, ""},
50+
{framework.AttachmentTypeISCSI, framework.BackupTypeIncremental, ""},
51+
{framework.AttachmentTypeISCSI, framework.BackupTypeFull, ""},
52+
{framework.AttachmentTypeISCSI, framework.BackupTypeIncremental, "xfs"},
53+
{framework.AttachmentTypeParavirtualized, framework.BackupTypeFull, "ext3"},
54+
}
55+
for _, entry := range tests {
56+
entry := entry
57+
testName := "Should be able to create and restore " + entry.backupType + " snapshot from " + entry.attachmentType + " volume "
58+
if entry.fsType != "" {
59+
testName += " with " + entry.fsType + " fsType"
60+
}
61+
It(testName, func() {
62+
scParams := map[string]string{framework.AttachmentType: entry.attachmentType}
63+
vscParams := map[string]string{framework.BackupType: entry.backupType}
64+
scParams[framework.FstypeKey] = entry.fsType
65+
testSnapshotAndRestore(f, scParams, vscParams, v1.PersistentVolumeBlock)
66+
})
67+
}
68+
It("FS should get expanded when a PVC is restored with a lesser size backup (iscsi)", func() {
69+
checkOrInstallCRDs(f)
70+
scParams := map[string]string{framework.AttachmentType: framework.AttachmentTypeISCSI}
71+
vscParams := map[string]string{framework.BackupType: framework.BackupTypeFull}
72+
pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-snapshot-restore-e2e-tests")
73+
pvcJig.InitialiseSnapClient(f.SnapClientSet)
74+
75+
scName := f.CreateStorageClassOrFail(f.Namespace.Name, BVDriverName, scParams, pvcJig.Labels, BindingModeWaitForFirstConsumer, true, ReclaimPolicyDelete, nil)
76+
pvc := pvcJig.CreateAndAwaitPVCOrFailCSI(f.Namespace.Name, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
77+
78+
_ = pvcJig.NewPodForCSI("pod-original", f.Namespace.Name, pvc.Name, setupF.AdLabel, v1.PersistentVolumeBlock)
79+
80+
time.Sleep(60 * time.Second) //waiting for pod to up and running
81+
82+
vscName := f.CreateVolumeSnapshotClassOrFail(f.Namespace.Name, BVDriverName, vscParams, ReclaimPolicyDelete)
83+
vs := pvcJig.CreateAndAwaitVolumeSnapshotOrFail(f.Namespace.Name, vscName, pvc.Name, nil)
84+
85+
pvcRestore := pvcJig.CreateAndAwaitPVCOrFailSnapshotSource(f.Namespace.Name, framework.MaxVolumeBlock, scName, vs.Name, v1.ClaimPending, false, nil)
86+
podRestoreName := pvcJig.NewPodForCSI("pod-restored", f.Namespace.Name, pvcRestore.Name, setupF.AdLabel, v1.PersistentVolumeBlock)
87+
88+
time.Sleep(60 * time.Second) //waiting for pod to up and running
89+
90+
pvcJig.CheckUsableVolumeSizeInsidePod(f.Namespace.Name, podRestoreName, "99G")
91+
92+
f.VolumeIds = append(f.VolumeIds, pvc.Spec.VolumeName)
93+
_ = f.DeleteVolumeSnapshotClass(f.Namespace.Name)
94+
_ = f.DeleteStorageClass(f.Namespace.Name)
95+
})
96+
It("FS should get expanded when a PVC is restored with a lesser size backup (paravirtualized)", func() {
97+
checkOrInstallCRDs(f)
98+
scParams := map[string]string{framework.AttachmentType: framework.AttachmentTypeParavirtualized}
99+
vscParams := map[string]string{framework.BackupType: framework.BackupTypeFull}
100+
pvcJig := framework.NewPVCTestJig(f.ClientSet, "csi-snapshot-restore-e2e-tests")
101+
pvcJig.InitialiseSnapClient(f.SnapClientSet)
102+
103+
scName := f.CreateStorageClassOrFail(f.Namespace.Name, BVDriverName, scParams, pvcJig.Labels, BindingModeWaitForFirstConsumer, true, ReclaimPolicyDelete, nil)
104+
pvc := pvcJig.CreateAndAwaitPVCOrFailCSI(f.Namespace.Name, framework.MinVolumeBlock, scName, nil, v1.PersistentVolumeFilesystem, v1.ReadWriteOnce, v1.ClaimPending)
105+
106+
_ = pvcJig.NewPodForCSI("pod-original", f.Namespace.Name, pvc.Name, setupF.AdLabel, v1.PersistentVolumeBlock)
107+
108+
time.Sleep(60 * time.Second) //waiting for pod to up and running
109+
110+
vscName := f.CreateVolumeSnapshotClassOrFail(f.Namespace.Name, BVDriverName, vscParams, ReclaimPolicyDelete)
111+
vs := pvcJig.CreateAndAwaitVolumeSnapshotOrFail(f.Namespace.Name, vscName, pvc.Name, nil)
112+
113+
pvcRestore := pvcJig.CreateAndAwaitPVCOrFailSnapshotSource(f.Namespace.Name, framework.MaxVolumeBlock, scName, vs.Name, v1.ClaimPending, false, nil)
114+
podRestoreName := pvcJig.NewPodForCSI("pod-restored", f.Namespace.Name, pvcRestore.Name, setupF.AdLabel, v1.PersistentVolumeBlock)
115+
116+
time.Sleep(60 * time.Second) //waiting for pod to up and running
117+
118+
pvcJig.CheckUsableVolumeSizeInsidePod(f.Namespace.Name, podRestoreName, "99G")
119+
120+
f.VolumeIds = append(f.VolumeIds, pvc.Spec.VolumeName)
121+
_ = f.DeleteVolumeSnapshotClass(f.Namespace.Name)
122+
_ = f.DeleteStorageClass(f.Namespace.Name)
123+
})
124124
It("Should be able to create and restore a snapshot from a backup(static case)", func() {
125125
checkOrInstallCRDs(f)
126126
scParams := map[string]string{framework.AttachmentType: framework.AttachmentTypeISCSI}

test/e2e/framework/service_util.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error {
546546
}
547547

548548
func (j *ServiceTestJig) WaitForLoadBalancerDestroyOrFail(namespace, name string, ip string, port int, timeout time.Duration) *v1.Service {
549-
// TODO: once support ticket 21807001 is resolved, reduce this timeout back to something reasonable
550549
defer func() {
551550
if err := EnsureLoadBalancerResourcesDeleted(ip, strconv.Itoa(port)); err != nil {
552551
Logf("Failed to delete cloud resources for service: %s %d (%v)", ip, port, err)

0 commit comments

Comments
 (0)