e2e: remove the release check in clone test validation

we no longer require the kubernetes validation for clone tests in
the e2e tests. This commit remove it for RBD.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2022-04-11 16:51:24 +05:30 committed by mergify[bot]
parent 5bc8584b02
commit 5e23010e2b

View File

@ -250,19 +250,17 @@ var _ = Describe("RBD Upgrade Testing", func() {
e2elog.Failf("failed to calculate checksum: %v", err) e2elog.Failf("failed to calculate checksum: %v", err)
} }
// pvc clone is only supported from v1.16+ // Create snapshot of the pvc
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) { snapshotPath := rbdExamplePath + "snapshot.yaml"
// Create snapshot of the pvc snap := getSnapshot(snapshotPath)
snapshotPath := rbdExamplePath + "snapshot.yaml" snap.Name = "rbd-pvc-snapshot"
snap := getSnapshot(snapshotPath) snap.Namespace = f.UniqueName
snap.Name = "rbd-pvc-snapshot" snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
snap.Namespace = f.UniqueName err = createSnapshot(&snap, deployTimeout)
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name if err != nil {
err = createSnapshot(&snap, deployTimeout) e2elog.Failf("failed to create snapshot %v", err)
if err != nil {
e2elog.Failf("failed to create snapshot %v", err)
}
} }
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
if err != nil { if err != nil {
e2elog.Failf("failed to delete application: %v", err) e2elog.Failf("failed to delete application: %v", err)
@ -299,52 +297,48 @@ var _ = Describe("RBD Upgrade Testing", func() {
pvcClonePath := rbdExamplePath + "pvc-restore.yaml" pvcClonePath := rbdExamplePath + "pvc-restore.yaml"
appClonePath := rbdExamplePath + "pod-restore.yaml" appClonePath := rbdExamplePath + "pod-restore.yaml"
label := make(map[string]string) label := make(map[string]string)
pvcClone, err := loadPVC(pvcClonePath)
// pvc clone is only supported from v1.16+ if err != nil {
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) { e2elog.Failf("failed to load pvc: %v", err)
pvcClone, err := loadPVC(pvcClonePath)
if err != nil {
e2elog.Failf("failed to load pvc: %v", err)
}
pvcClone.Namespace = f.UniqueName
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
pvcClone.Spec.DataSource.Name = "rbd-pvc-snapshot"
appClone, err := loadApp(appClonePath)
if err != nil {
e2elog.Failf("failed to load application: %v", err)
}
label[appKey] = "validate-snap-clone"
appClone.Namespace = f.UniqueName
appClone.Name = "app-clone-from-snap"
appClone.Labels = label
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
if err != nil {
e2elog.Failf("failed to create pvc: %v", err)
}
opt := metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
}
mountPath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath
testFilePath := filepath.Join(mountPath, "testClone")
newCheckSum, err := calculateSHA512sum(f, appClone, testFilePath, &opt)
if err != nil {
e2elog.Failf("failed to calculate checksum: %v", err)
}
if strings.Compare(newCheckSum, checkSum) != 0 {
e2elog.Failf(
"The checksum of files did not match, expected %s received %s",
checkSum,
newCheckSum)
}
e2elog.Logf("The checksum of files matched")
// delete cloned pvc and pod
err = deletePVCAndApp("", f, pvcClone, appClone)
if err != nil {
e2elog.Failf("failed to delete pvc and application: %v", err)
}
} }
pvcClone.Namespace = f.UniqueName
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
pvcClone.Spec.DataSource.Name = "rbd-pvc-snapshot"
appClone, err := loadApp(appClonePath)
if err != nil {
e2elog.Failf("failed to load application: %v", err)
}
label[appKey] = "validate-snap-clone"
appClone.Namespace = f.UniqueName
appClone.Name = "app-clone-from-snap"
appClone.Labels = label
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
if err != nil {
e2elog.Failf("failed to create pvc: %v", err)
}
opt := metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
}
mountPath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath
testFilePath := filepath.Join(mountPath, "testClone")
newCheckSum, err := calculateSHA512sum(f, appClone, testFilePath, &opt)
if err != nil {
e2elog.Failf("failed to calculate checksum: %v", err)
}
if strings.Compare(newCheckSum, checkSum) != 0 {
e2elog.Failf(
"The checksum of files did not match, expected %s received %s",
checkSum,
newCheckSum)
}
e2elog.Logf("The checksum of files matched")
// delete cloned pvc and pod
err = deletePVCAndApp("", f, pvcClone, appClone)
if err != nil {
e2elog.Failf("failed to delete pvc and application: %v", err)
}
}) })
By("Create clone from existing PVC", func() { By("Create clone from existing PVC", func() {
@ -352,50 +346,46 @@ var _ = Describe("RBD Upgrade Testing", func() {
appSmartClonePath := rbdExamplePath + "pod-clone.yaml" appSmartClonePath := rbdExamplePath + "pod-clone.yaml"
label := make(map[string]string) label := make(map[string]string)
// pvc clone is only supported from v1.16+ pvcClone, err := loadPVC(pvcSmartClonePath)
if k8sVersionGreaterEquals(f.ClientSet, 1, 16) { if err != nil {
pvcClone, err := loadPVC(pvcSmartClonePath) e2elog.Failf("failed to load pvc: %v", err)
if err != nil { }
e2elog.Failf("failed to load pvc: %v", err) pvcClone.Spec.DataSource.Name = pvc.Name
} pvcClone.Namespace = f.UniqueName
pvcClone.Spec.DataSource.Name = pvc.Name pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
pvcClone.Namespace = f.UniqueName appClone, err := loadApp(appSmartClonePath)
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize) if err != nil {
appClone, err := loadApp(appSmartClonePath) e2elog.Failf("failed to load application: %v", err)
if err != nil { }
e2elog.Failf("failed to load application: %v", err) label[appKey] = "validate-clone"
} appClone.Namespace = f.UniqueName
label[appKey] = "validate-clone" appClone.Name = "appclone"
appClone.Namespace = f.UniqueName appClone.Labels = label
appClone.Name = "appclone" err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
appClone.Labels = label if err != nil {
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout) e2elog.Failf("failed to create pvc: %v", err)
if err != nil { }
e2elog.Failf("failed to create pvc: %v", err) opt := metav1.ListOptions{
} LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
opt := metav1.ListOptions{ }
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]), mountPath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath
} testFilePath := filepath.Join(mountPath, "testClone")
mountPath := appClone.Spec.Containers[0].VolumeMounts[0].MountPath newCheckSum, err := calculateSHA512sum(f, appClone, testFilePath, &opt)
testFilePath := filepath.Join(mountPath, "testClone") if err != nil {
newCheckSum, err := calculateSHA512sum(f, appClone, testFilePath, &opt) e2elog.Failf("failed to calculate checksum: %v", err)
if err != nil { }
e2elog.Failf("failed to calculate checksum: %v", err) if strings.Compare(newCheckSum, checkSum) != 0 {
} e2elog.Failf(
if strings.Compare(newCheckSum, checkSum) != 0 { "The checksum of files did not match, expected %s received %s",
e2elog.Failf( checkSum,
"The checksum of files did not match, expected %s received %s", newCheckSum)
checkSum, }
newCheckSum) e2elog.Logf("The checksum of files matched")
}
e2elog.Logf("The checksum of files matched")
// delete cloned pvc and pod
err = deletePVCAndApp("", f, pvcClone, appClone)
if err != nil {
e2elog.Failf("failed to delete pvc and application: %v", err)
}
// delete cloned pvc and pod
err = deletePVCAndApp("", f, pvcClone, appClone)
if err != nil {
e2elog.Failf("failed to delete pvc and application: %v", err)
} }
}) })
@ -403,35 +393,32 @@ var _ = Describe("RBD Upgrade Testing", func() {
pvcExpandSize := "5Gi" pvcExpandSize := "5Gi"
label := make(map[string]string) label := make(map[string]string)
// Resize 0.3.0 is only supported from v1.15+ label[appKey] = appLabel
if k8sVersionGreaterEquals(f.ClientSet, 1, 15) { opt := metav1.ListOptions{
label[appKey] = appLabel LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
opt := metav1.ListOptions{ }
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]), var err error
} pvc, err = f.ClientSet.CoreV1().
var err error PersistentVolumeClaims(pvc.Namespace).
pvc, err = f.ClientSet.CoreV1(). Get(context.TODO(), pvc.Name, metav1.GetOptions{})
PersistentVolumeClaims(pvc.Namespace). if err != nil {
Get(context.TODO(), pvc.Name, metav1.GetOptions{}) e2elog.Failf("failed to get pvc: %v", err)
if err != nil { }
e2elog.Failf("failed to get pvc: %v", err)
}
// resize PVC // resize PVC
err = expandPVCSize(f.ClientSet, pvc, pvcExpandSize, deployTimeout) err = expandPVCSize(f.ClientSet, pvc, pvcExpandSize, deployTimeout)
if err != nil { if err != nil {
e2elog.Failf("failed to expand pvc: %v", err) e2elog.Failf("failed to expand pvc: %v", err)
} }
// wait for application pod to come up after resize // wait for application pod to come up after resize
err = waitForPodInRunningState(app.Name, app.Namespace, f.ClientSet, deployTimeout, noError) err = waitForPodInRunningState(app.Name, app.Namespace, f.ClientSet, deployTimeout, noError)
if err != nil { if err != nil {
e2elog.Failf("timeout waiting for pod to be in running state: %v", err) e2elog.Failf("timeout waiting for pod to be in running state: %v", err)
} }
// validate if resize is successful. // validate if resize is successful.
err = checkDirSize(app, f, &opt, pvcExpandSize) err = checkDirSize(app, f, &opt, pvcExpandSize)
if err != nil { if err != nil {
e2elog.Failf("failed to check directory size: %v", err) e2elog.Failf("failed to check directory size: %v", err)
}
} }
}) })