mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-20 01:01:22 +00:00
Merge pull request #119902 from RomanBednar/pv-phase-transition-time-e2e
e2e: add test for verification of timestamp for new PVs
This commit is contained in:
commit
50578c4b58
@ -208,9 +208,27 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
completeTest(ctx, f, c, ns, pv, pvc)
|
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
|
// 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.
|
// 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)
|
pv, pvc, err = e2epv.CreatePVPVC(ctx, c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
@ -230,7 +248,7 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
|
|||||||
// Create PV and pre-bound PVC that matches the PV, verify that when PV and PVC bind
|
// 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
|
// 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.
|
// 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)
|
pv, pvc, err = e2epv.CreatePVPVC(ctx, c, f.Timeouts, pvConfig, pvcConfig, ns, true)
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user