mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
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 CephFS. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
5e23010e2b
commit
b64c7583a9
@ -230,19 +230,15 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to calculate checksum: %v", err)
|
e2elog.Failf("failed to calculate checksum: %v", err)
|
||||||
}
|
}
|
||||||
|
// Create snapshot of the pvc
|
||||||
// pvc clone is only supported from v1.16+
|
snapshotPath := cephFSExamplePath + "snapshot.yaml"
|
||||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
snap := getSnapshot(snapshotPath)
|
||||||
// Create snapshot of the pvc
|
snap.Name = "cephfs-pvc-snapshot"
|
||||||
snapshotPath := cephFSExamplePath + "snapshot.yaml"
|
snap.Namespace = f.UniqueName
|
||||||
snap := getSnapshot(snapshotPath)
|
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
|
||||||
snap.Name = "cephfs-pvc-snapshot"
|
err = createSnapshot(&snap, deployTimeout)
|
||||||
snap.Namespace = f.UniqueName
|
if err != nil {
|
||||||
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
|
e2elog.Failf("failed to create snapshot %v", err)
|
||||||
err = createSnapshot(&snap, deployTimeout)
|
|
||||||
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 {
|
||||||
@ -280,62 +276,56 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
|||||||
pvcClonePath := cephFSExamplePath + "pvc-restore.yaml"
|
pvcClonePath := cephFSExamplePath + "pvc-restore.yaml"
|
||||||
appClonePath := cephFSExamplePath + "pod-restore.yaml"
|
appClonePath := cephFSExamplePath + "pod-restore.yaml"
|
||||||
label := make(map[string]string)
|
label := make(map[string]string)
|
||||||
|
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)
|
||||||
|
appClone, err = loadApp(appClonePath)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to load application: %v", err)
|
||||||
|
}
|
||||||
|
label[appKey] = "validate-snap-cephfs"
|
||||||
|
appClone.Namespace = f.UniqueName
|
||||||
|
appClone.Name = "snap-clone-cephfs"
|
||||||
|
appClone.Labels = label
|
||||||
|
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create pvc and application: %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")
|
||||||
|
|
||||||
// pvc clone is only supported from v1.16+
|
// delete cloned pvc and pod
|
||||||
if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
err = deletePVCAndApp("", f, pvcClone, appClone)
|
||||||
pvcClone, err = loadPVC(pvcClonePath)
|
if err != nil {
|
||||||
if err != nil {
|
Fail(err.Error())
|
||||||
e2elog.Failf("failed to load pvc: %v", err)
|
}
|
||||||
}
|
|
||||||
pvcClone.Namespace = f.UniqueName
|
|
||||||
pvcClone.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(pvcSize)
|
|
||||||
appClone, err = loadApp(appClonePath)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to load application: %v", err)
|
|
||||||
}
|
|
||||||
label[appKey] = "validate-snap-cephfs"
|
|
||||||
appClone.Namespace = f.UniqueName
|
|
||||||
appClone.Name = "snap-clone-cephfs"
|
|
||||||
appClone.Labels = label
|
|
||||||
err = createPVCAndApp("", f, pvcClone, appClone, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to create pvc and application: %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 {
|
|
||||||
Fail(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete the snapshot of the parent pvc.
|
|
||||||
snapshotPath := cephFSExamplePath + "snapshot.yaml"
|
|
||||||
snap := getSnapshot(snapshotPath)
|
|
||||||
snap.Name = "cephfs-pvc-snapshot"
|
|
||||||
snap.Namespace = f.UniqueName
|
|
||||||
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
|
|
||||||
err = deleteSnapshot(&snap, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to delete snapshot %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Delete the snapshot of the parent pvc.
|
||||||
|
snapshotPath := cephFSExamplePath + "snapshot.yaml"
|
||||||
|
snap := getSnapshot(snapshotPath)
|
||||||
|
snap.Name = "cephfs-pvc-snapshot"
|
||||||
|
snap.Namespace = f.UniqueName
|
||||||
|
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
|
||||||
|
err = deleteSnapshot(&snap, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete snapshot %v", err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -344,51 +334,47 @@ var _ = Describe("CephFS Upgrade Testing", func() {
|
|||||||
appSmartClonePath := cephFSExamplePath + "pod-clone.yaml"
|
appSmartClonePath := cephFSExamplePath + "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-snap-cephfs"
|
||||||
}
|
appClone.Namespace = f.UniqueName
|
||||||
label[appKey] = "validate-snap-cephfs"
|
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 and application: %v", err)
|
||||||
if err != nil {
|
}
|
||||||
e2elog.Failf("failed to create pvc and application: %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 {
|
if strings.Compare(newCheckSum, checkSum) != 0 {
|
||||||
e2elog.Failf(
|
e2elog.Failf(
|
||||||
"The checksum of files did not match, expected %s received %s",
|
"The checksum of files did not match, expected %s received %s",
|
||||||
checkSum,
|
checkSum,
|
||||||
newCheckSum)
|
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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -396,34 +382,31 @@ var _ = Describe("CephFS 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]),
|
pvc, err = f.ClientSet.CoreV1().
|
||||||
}
|
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)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -338,7 +338,6 @@ var _ = Describe("RBD Upgrade Testing", func() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to delete pvc and application: %v", err)
|
e2elog.Failf("failed to delete pvc and application: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
By("Create clone from existing PVC", func() {
|
By("Create clone from existing PVC", func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user