Skip to content

Commit

Permalink
add status deleting of volumesnapshot
Browse files Browse the repository at this point in the history
Signed-off-by: zhangmin <arminzhang@yunify.com>
  • Loading branch information
min-zh committed Sep 21, 2020
1 parent 6f12f72 commit 20f4c4b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
const (
statusCreating = "creating"
statusReady = "ready"
statusDeleting = "deleting"

volumeSnapshotClassName = "volumeSnapshotClassName"
persistentVolumeClaimName = "persistentVolumeClaimName"
Expand Down Expand Up @@ -96,5 +97,8 @@ func snapshotStatus(item *v1beta1.VolumeSnapshot) string {
if item != nil && item.Status != nil && item.Status.ReadyToUse != nil && *item.Status.ReadyToUse {
status = statusReady
}
if item != nil && item.DeletionTimestamp != nil{
status = statusDeleting
}
return status
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,17 @@ func TestListVolumeSnapshot(t *testing.T) {
}
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")
}

//func TestVolumeSnapshotStatus( t *testing.T) {
// RegisterFailHandler(Fail)
//
// RunSpecs(t, "volume snapshot status")
//}

0 comments on commit 20f4c4b

Please sign in to comment.