@@ -247,84 +247,6 @@ func TestHandleActionSnapshotRestore(t *testing.T) {
247
247
assert .True (t , apierrors .IsNotFound (err ), "TASR should not have been found" )
248
248
}
249
249
250
- func TestHandleActionSnapshotRestore_Disabled (t * testing.T ) {
251
- // Reset the package-level state after the test completes.
252
- defer acp .SetAPI (acp .API ())
253
-
254
- mockCtrl := gomock .NewController (t )
255
- mockACP := mockacp .NewMockTridentACP (mockCtrl )
256
- acp .SetAPI (mockACP )
257
- orchestrator := mockcore .NewMockOrchestrator (mockCtrl )
258
-
259
- tridentNamespace := "trident"
260
- kubeClient := GetTestKubernetesClientset ()
261
- snapClient := GetTestSnapshotClientset ()
262
- crdClient := GetTestCrdClientset ()
263
- crdController , err := newTridentCrdControllerImpl (orchestrator , tridentNamespace , kubeClient , snapClient , crdClient )
264
- if err != nil {
265
- t .Fatalf ("cannot create Trident CRD controller frontend; %v" , err )
266
- }
267
-
268
- // Mock out any expected calls on the ACP API.
269
- // This test expects the feature call to return false / unsupported.
270
- err = errors .UnsupportedError ("unsupported feature" )
271
- mockACP .EXPECT ().IsFeatureEnabled (gomock .Any (), acp .FeatureSnapshotRestore ).Return (err ).AnyTimes ()
272
-
273
- // Activate the CRD controller and start monitoring
274
- if err = crdController .Activate (); err != nil {
275
- t .Fatalf ("error while activating; %v" , err )
276
- }
277
- time .Sleep (250 * time .Millisecond )
278
-
279
- pvc := fakeSnapRestorePVC (snapRestorePVC1 , namespace1 , snapRestorePV1 )
280
- _ , _ = kubeClient .CoreV1 ().PersistentVolumeClaims (namespace1 ).Create (ctx (), pvc , createOpts )
281
-
282
- pv := fakePV (snapRestorePVC1 , namespace1 , snapRestorePV1 )
283
- _ , _ = kubeClient .CoreV1 ().PersistentVolumes ().Create (ctx (), pv , createOpts )
284
-
285
- vs1Time := time .Now ()
286
- vs2Time := vs1Time .Add (1 * time .Second )
287
- vs3Time := vs2Time .Add (1 * time .Second )
288
-
289
- vs1 := fakeVS (snapRestoreSnap1 , namespace1 , snapRestoreVSC1 , snapRestorePVC1 , vs1Time )
290
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshots (namespace1 ).Create (ctx (), vs1 , createOpts )
291
-
292
- vsc1 := fakeVSC (snapRestoreSnap1 , namespace1 , snapRestoreVSC1 , snapRestoreSnapHandle1 , vs1Time )
293
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshotContents ().Create (ctx (), vsc1 , createOpts )
294
-
295
- vs2 := fakeVS (snapRestoreSnap2 , namespace1 , snapRestoreVSC2 , snapRestorePVC1 , vs2Time )
296
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshots (namespace1 ).Create (ctx (), vs2 , createOpts )
297
-
298
- vsc2 := fakeVSC (snapRestoreSnap2 , namespace1 , snapRestoreVSC2 , snapRestoreSnapHandle2 , vs2Time )
299
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshotContents ().Create (ctx (), vsc2 , createOpts )
300
-
301
- vs3 := fakeVS (snapRestoreSnap3 , namespace1 , snapRestoreVSC3 , snapRestorePVC1 , vs3Time )
302
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshots (namespace1 ).Create (ctx (), vs3 , createOpts )
303
-
304
- vsc3 := fakeVSC (snapRestoreSnap3 , namespace1 , snapRestoreVSC3 , snapRestoreSnapHandle3 , vs3Time )
305
- _ , _ = snapClient .SnapshotV1 ().VolumeSnapshotContents ().Create (ctx (), vsc3 , createOpts )
306
-
307
- tasr := fakeTASR (tasr1 , namespace1 , snapRestorePVC1 , snapRestoreSnap3 )
308
- _ , _ = crdClient .TridentV1 ().TridentActionSnapshotRestores (namespace1 ).Create (ctx (), tasr , createOpts )
309
-
310
- // Wait until the operation completes
311
- for i := 0 ; i < 20 ; i ++ {
312
- time .Sleep (250 * time .Millisecond )
313
-
314
- tasr , err = crdClient .TridentV1 ().TridentActionSnapshotRestores (namespace1 ).Get (ctx (), tasr1 , getOpts )
315
- if err != nil {
316
- if apierrors .IsNotFound (err ) {
317
- continue
318
- }
319
- break
320
- } else if tasr .IsComplete () {
321
- break
322
- }
323
- }
324
-
325
- assert .True (t , tasr .Failed (), "TASR operation did not fail" )
326
- }
327
-
328
250
func TestHandleActionSnapshotRestore_InProgressError (t * testing.T ) {
329
251
// Reset the package-level state after the test completes.
330
252
defer acp .SetAPI (acp .API ())
0 commit comments