@@ -59,13 +59,17 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
59
59
serviceName string
60
60
pandoraSyncWaitTime int
61
61
storagePolicyName string
62
+ adminClient clientset.Interface
62
63
)
63
64
64
65
ginkgo .BeforeEach (func () {
65
66
bootstrap ()
66
67
ctx , cancel := context .WithCancel (context .Background ())
67
68
defer cancel ()
68
69
client = f .ClientSet
70
+ var err error
71
+
72
+ adminClient , client = initializeClusterClientsByUserRoles (client )
69
73
namespace = getNamespaceToRunTests (f )
70
74
scParameters = make (map [string ]string )
71
75
isServiceStopped = false
@@ -114,12 +118,13 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
114
118
ctx , vSphereCSIControllerPodNamePrefix , metav1.GetOptions {})
115
119
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
116
120
svcCsiReplicas = * csiDeployment .Spec .Replicas
117
- }
121
+ } else {
118
122
119
- csiDeployment , err := client .AppsV1 ().Deployments (csiNamespace ).Get (
120
- ctx , vSphereCSIControllerPodNamePrefix , metav1.GetOptions {})
121
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
122
- csiReplicas = * csiDeployment .Spec .Replicas
123
+ csiDeployment , err := client .AppsV1 ().Deployments (csiNamespace ).Get (
124
+ ctx , vSphereCSIControllerPodNamePrefix , metav1.GetOptions {})
125
+ gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
126
+ csiReplicas = * csiDeployment .Spec .Replicas
127
+ }
123
128
124
129
if os .Getenv (envPandoraSyncWaitTime ) != "" {
125
130
pandoraSyncWaitTime , err = strconv .Atoi (os .Getenv (envPandoraSyncWaitTime ))
@@ -143,15 +148,15 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
143
148
if serviceName == "CSI" {
144
149
framework .Logf ("Starting CSI driver" )
145
150
ignoreLabels := make (map [string ]string )
146
- err := updateDeploymentReplicawithWait (client , csiReplicas , vSphereCSIControllerPodNamePrefix ,
151
+ err := updateDeploymentReplicawithWait (adminClient , csiReplicas , vSphereCSIControllerPodNamePrefix ,
147
152
csiSystemNamespace )
148
153
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
149
154
150
155
// Wait for the CSI Pods to be up and Running
151
- list_of_pods , err := fpod .GetPodsInNamespace (ctx , client , csiSystemNamespace , ignoreLabels )
156
+ list_of_pods , err := fpod .GetPodsInNamespace (ctx , adminClient , csiSystemNamespace , ignoreLabels )
152
157
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
153
158
num_csi_pods := len (list_of_pods )
154
- err = fpod .WaitForPodsRunningReady (ctx , client , csiSystemNamespace , int (num_csi_pods ),
159
+ err = fpod .WaitForPodsRunningReady (ctx , adminClient , csiSystemNamespace , int (num_csi_pods ),
155
160
time .Duration (pollTimeout ))
156
161
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
157
162
} else if serviceName == hostdServiceName {
@@ -170,7 +175,15 @@ var _ = ginkgo.Describe("[block-snapshot-negative] Volume Snapshot Fault-Injecti
170
175
}
171
176
172
177
ginkgo .By (fmt .Sprintf ("Resetting provisioner time interval to %s sec" , defaultProvisionerTimeInSec ))
173
- updateCSIDeploymentProvisionerTimeout (client , csiSystemNamespace , defaultProvisionerTimeInSec )
178
+ updateCSIDeploymentProvisionerTimeout (adminClient , csiSystemNamespace , defaultProvisionerTimeInSec )
179
+
180
+ if supervisorCluster {
181
+ dumpSvcNsEventsOnTestFailure (client , namespace )
182
+ }
183
+ if guestCluster {
184
+ svcClient , svNamespace := getSvcClientAndNamespace ()
185
+ dumpSvcNsEventsOnTestFailure (svcClient , svNamespace )
186
+ }
174
187
})
175
188
176
189
/*
@@ -318,6 +331,13 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
318
331
319
332
storagePolicyName := GetAndExpectStringEnvVar (envStoragePolicyNameForSharedDatastores )
320
333
334
+ /*var testClient clientset.Interface
335
+ if vanillaCluster {
336
+ testClient = client
337
+ } else {
338
+ testClient = adminClient
339
+ }*/
340
+ adminClient , _ := initializeClusterClientsByUserRoles (client )
321
341
if vanillaCluster {
322
342
ginkgo .By ("Create storage class" )
323
343
scParameters [scParamDatastoreURL ] = datastoreURL
@@ -329,7 +349,7 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
329
349
}()
330
350
} else if supervisorCluster {
331
351
ginkgo .By ("Get storage class" )
332
- storageclass , err = client .StorageV1 ().StorageClasses ().Get (ctx , storagePolicyName , metav1.GetOptions {})
352
+ storageclass , err = adminClient .StorageV1 ().StorageClasses ().Get (ctx , storagePolicyName , metav1.GetOptions {})
333
353
if ! apierrors .IsNotFound (err ) {
334
354
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
335
355
}
@@ -340,7 +360,7 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
340
360
storageclass , err = createStorageClass (client , scParameters , nil , "" , "" , false , "" )
341
361
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
342
362
defer func () {
343
- err := client .StorageV1 ().StorageClasses ().Delete (ctx , storageclass .Name , * metav1 .NewDeleteOptions (0 ))
363
+ err := adminClient .StorageV1 ().StorageClasses ().Delete (ctx , storageclass .Name , * metav1 .NewDeleteOptions (0 ))
344
364
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
345
365
}()
346
366
}
@@ -404,18 +424,18 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
404
424
405
425
if serviceName == "CSI" {
406
426
ginkgo .By ("Stopping CSI driver" )
407
- isServiceStopped , err = stopCSIPods (ctx , client , csiNamespace )
427
+ isServiceStopped , err = stopCSIPods (ctx , adminClient , csiNamespace )
408
428
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
409
429
410
430
defer func () {
411
431
if isServiceStopped {
412
432
framework .Logf ("Starting CSI driver" )
413
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
433
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
414
434
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
415
435
}
416
436
}()
417
437
framework .Logf ("Starting CSI driver" )
418
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
438
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
419
439
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
420
440
421
441
ginkgo .By (fmt .Sprintf ("Sleeping for %v seconds to allow full sync finish" , fullSyncWaitTime ))
@@ -531,17 +551,17 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
531
551
532
552
if serviceName == "CSI" {
533
553
ginkgo .By ("Stopping CSI driver" )
534
- isServiceStopped , err = stopCSIPods (ctx , client , csiNamespace )
554
+ isServiceStopped , err = stopCSIPods (ctx , adminClient , csiNamespace )
535
555
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
536
556
defer func () {
537
557
if isServiceStopped {
538
558
framework .Logf ("Starting CSI driver" )
539
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
559
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
540
560
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
541
561
}
542
562
}()
543
563
framework .Logf ("Starting CSI driver" )
544
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
564
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
545
565
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
546
566
547
567
ginkgo .By (fmt .Sprintf ("Sleeping for %v seconds to allow full sync finish" , fullSyncWaitTime ))
@@ -633,7 +653,7 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
633
653
634
654
//After service restart
635
655
bootstrap ()
636
- persistentvolumes2 , err := fpv . WaitForPVClaimBoundPhase (ctx , client ,
656
+ persistentvolumes2 , err := WaitForPVClaimBoundPhase (ctx , client ,
637
657
[]* v1.PersistentVolumeClaim {pvclaim2 }, framework .ClaimProvisionTimeout )
638
658
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
639
659
volHandle2 := persistentvolumes2 [0 ].Spec .CSI .VolumeHandle
@@ -657,18 +677,18 @@ func snapshotOperationWhileServiceDown(serviceName string, namespace string,
657
677
if isSnapshotCreated {
658
678
if serviceName == "CSI" {
659
679
ginkgo .By ("Stopping CSI driver" )
660
- isServiceStopped , err = stopCSIPods (ctx , client , csiNamespace )
680
+ isServiceStopped , err = stopCSIPods (ctx , adminClient , csiNamespace )
661
681
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
662
682
663
683
defer func () {
664
684
if isServiceStopped {
665
685
framework .Logf ("Starting CSI driver" )
666
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
686
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
667
687
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
668
688
}
669
689
}()
670
690
framework .Logf ("Starting CSI driver" )
671
- isServiceStopped , err = startCSIPods (ctx , client , csiReplicas , csiNamespace )
691
+ isServiceStopped , err = startCSIPods (ctx , adminClient , csiReplicas , csiNamespace )
672
692
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
673
693
674
694
ginkgo .By (fmt .Sprintf ("Sleeping for %v seconds to allow full sync finish" , fullSyncWaitTime ))
0 commit comments