Merge pull request #2980 from min-zh/dev
add status deleting of volumesnapshot
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
statusCreating = "creating"
|
statusCreating = "creating"
|
||||||
statusReady = "ready"
|
statusReady = "ready"
|
||||||
|
statusDeleting = "deleting"
|
||||||
|
|
||||||
volumeSnapshotClassName = "volumeSnapshotClassName"
|
volumeSnapshotClassName = "volumeSnapshotClassName"
|
||||||
persistentVolumeClaimName = "persistentVolumeClaimName"
|
persistentVolumeClaimName = "persistentVolumeClaimName"
|
||||||
@@ -96,5 +97,8 @@ func snapshotStatus(item *v1beta1.VolumeSnapshot) string {
|
|||||||
if item != nil && item.Status != nil && item.Status.ReadyToUse != nil && *item.Status.ReadyToUse {
|
if item != nil && item.Status != nil && item.Status.ReadyToUse != nil && *item.Status.ReadyToUse {
|
||||||
status = statusReady
|
status = statusReady
|
||||||
}
|
}
|
||||||
|
if item != nil && item.DeletionTimestamp != nil{
|
||||||
|
status = statusDeleting
|
||||||
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,13 +208,17 @@ func TestListVolumeSnapshot(t *testing.T) {
|
|||||||
}
|
}
|
||||||
Expect(snapshotStatus(snapshot)).To(Equal(statusReady))
|
Expect(snapshotStatus(snapshot)).To(Equal(statusReady))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("snapshot.DeletionTimestamp != nil", func() {
|
||||||
|
deleteTime := v1.Now()
|
||||||
|
snapshot.DeletionTimestamp = &deleteTime
|
||||||
|
defer func() {
|
||||||
|
snapshot.DeletionTimestamp = nil
|
||||||
|
}()
|
||||||
|
Expect(snapshotStatus(snapshot)).To(Equal(statusDeleting))
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
RunSpecs(t, "volume snapshot getter list")
|
RunSpecs(t, "volume snapshot getter list")
|
||||||
}
|
}
|
||||||
|
|
||||||
//func TestVolumeSnapshotStatus( t *testing.T) {
|
|
||||||
// RegisterFailHandler(Fail)
|
|
||||||
//
|
|
||||||
// RunSpecs(t, "volume snapshot status")
|
|
||||||
//}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user