@@ -19,6 +19,7 @@ package csi
1919import (
2020 "fmt"
2121 "testing"
22+ "time"
2223
2324 "github.com/google/go-cmp/cmp"
2425 "github.com/google/go-cmp/cmp/cmpopts"
@@ -219,7 +220,7 @@ func TestVSProgress(t *testing.T) {
219220 expectedErr : false ,
220221 },
221222 {
222- name : "VS status has error" ,
223+ name : "VS status has error, no prior annotation, no CSISnapshotTimeout configured " ,
223224 operationID : "ns/name/2024-04-11T18:49:00+08:00" ,
224225 vs : builder .ForVolumeSnapshot ("ns" , "name" ).Status ().
225226 StatusError (snapshotv1api.VolumeSnapshotError {
@@ -228,6 +229,38 @@ func TestVSProgress(t *testing.T) {
228229 backup : builder .ForBackup ("velero" , "backup" ).Result (),
229230 expectedErr : false ,
230231 },
232+ {
233+ name : "VS status has error, annotation within CSISnapshotTimeout" ,
234+ operationID : "ns/name/2024-04-11T18:49:00+08:00" ,
235+ vs : builder .ForVolumeSnapshot ("ns" , "name" ).
236+ ObjectMeta (builder .WithAnnotations (
237+ velerov1api .VSErrorFirstObservedTimeAnnotation , time .Now ().Format (time .RFC3339 ),
238+ )).
239+ Status ().
240+ StatusError (snapshotv1api.VolumeSnapshotError {
241+ Message : & errorStr ,
242+ }).Result (),
243+ backup : builder .ForBackup ("velero" , "backup" ).CSISnapshotTimeout (10 * time .Minute ).Result (),
244+ expectedErr : false ,
245+ },
246+ {
247+ name : "VS status has persistent error beyond CSISnapshotTimeout" ,
248+ operationID : "ns/name/2024-04-11T18:49:00+08:00" ,
249+ vs : builder .ForVolumeSnapshot ("ns" , "name" ).
250+ ObjectMeta (builder .WithAnnotations (
251+ velerov1api .VSErrorFirstObservedTimeAnnotation , "2024-04-11T18:49:00+08:00" ,
252+ )).
253+ Status ().
254+ StatusError (snapshotv1api.VolumeSnapshotError {
255+ Message : & errorStr ,
256+ }).Result (),
257+ backup : builder .ForBackup ("velero" , "backup" ).CSISnapshotTimeout (10 * time .Minute ).Result (),
258+ expectedErr : false ,
259+ expectedProgress : & velero.OperationProgress {
260+ Completed : true ,
261+ Err : fmt .Sprintf ("VolumeSnapshot ns/name has a persistent error: %s" , errorStr ),
262+ },
263+ },
231264 {
232265 name : "Fail to get VSC" ,
233266 operationID : "ns/name/2024-04-11T18:49:00+08:00" ,
0 commit comments