From 8e6614987022a2cfdf51d183c6f5a166ee1e4e9a Mon Sep 17 00:00:00 2001 From: Roman Bednar Date: Fri, 11 Aug 2023 11:28:11 +0200 Subject: [PATCH 1/2] e2e: remove extra spaces --- test/e2e/storage/persistent_volumes.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/persistent_volumes.go b/test/e2e/storage/persistent_volumes.go index 963e1dea9e4..1619f8319e2 100644 --- a/test/e2e/storage/persistent_volumes.go +++ b/test/e2e/storage/persistent_volumes.go @@ -204,7 +204,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() { // Create PV and pre-bound PVC that matches the PV, verify that when PV and PVC bind // the LastPhaseTransitionTime filed of the PV is updated. - ginkgo.It("create a PV and a pre-bound PVC: test phase transition timestamp is set [Feature: PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) { + ginkgo.It("create a PV and a pre-bound PVC: test phase transition timestamp is set [Feature:PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) { pv, pvc, err = e2epv.CreatePVPVC(ctx, c, f.Timeouts, pvConfig, pvcConfig, ns, true) framework.ExpectNoError(err) @@ -224,7 +224,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() { // Create PV and pre-bound PVC that matches the PV, verify that when PV and PVC bind // the LastPhaseTransitionTime field of the PV is set, then delete the PVC to change PV phase to // released and validate PV LastPhaseTransitionTime correctly updated timestamp. - ginkgo.It("create a PV and a pre-bound PVC: test phase transition timestamp multiple updates [Feature: PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) { + ginkgo.It("create a PV and a pre-bound PVC: test phase transition timestamp multiple updates [Feature:PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) { pv, pvc, err = e2epv.CreatePVPVC(ctx, c, f.Timeouts, pvConfig, pvcConfig, ns, true) framework.ExpectNoError(err) From dd7b7073c38a177abc076df8007e24a39fc4dc20 Mon Sep 17 00:00:00 2001 From: Roman Bednar Date: Fri, 11 Aug 2023 11:39:47 +0200 Subject: [PATCH 2/2] e2e: add test for verification of timestamp for new PVs --- test/e2e/storage/persistent_volumes.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/e2e/storage/persistent_volumes.go b/test/e2e/storage/persistent_volumes.go index 1619f8319e2..888c363e53d 100644 --- a/test/e2e/storage/persistent_volumes.go +++ b/test/e2e/storage/persistent_volumes.go @@ -202,6 +202,24 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() { completeTest(ctx, f, c, ns, pv, pvc) }) + // Create new PV without claim, verify it's in Available state and LastPhaseTransitionTime is set. + ginkgo.It("create a PV: test phase transition timestamp is set and phase is Available [Feature:PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) { + pvObj := e2epv.MakePersistentVolume(pvConfig) + pv, err = e2epv.CreatePV(ctx, c, f.Timeouts, pvObj) + framework.ExpectNoError(err) + + // The new PV should transition phase to: Available + err = e2epv.WaitForPersistentVolumePhase(ctx, v1.VolumeAvailable, c, pv.Name, 2*time.Second, framework.ClaimProvisionShortTimeout) + framework.ExpectNoError(err) + + // Verify that new PV has phase transition timestamp set. + pv, err = c.CoreV1().PersistentVolumes().Get(ctx, pv.Name, metav1.GetOptions{}) + framework.ExpectNoError(err) + if pv.Status.LastPhaseTransitionTime == nil { + framework.Failf("New persistent volume %v should have LastPhaseTransitionTime value set, but it's nil.", pv.GetName()) + } + }) + // Create PV and pre-bound PVC that matches the PV, verify that when PV and PVC bind // the LastPhaseTransitionTime filed of the PV is updated. ginkgo.It("create a PV and a pre-bound PVC: test phase transition timestamp is set [Feature:PersistentVolumeLastPhaseTransitionTime]", func(ctx context.Context) {