@@ -14,6 +14,7 @@ import (
14
14
corev1 "k8s.io/api/core/v1"
15
15
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
16
16
"k8s.io/apimachinery/pkg/types"
17
+ "k8s.io/klog"
17
18
addonapiv1alpha1 "open-cluster-management.io/api/addon/v1alpha1"
18
19
clusterv1 "open-cluster-management.io/api/cluster/v1"
19
20
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -87,7 +88,7 @@ var _ = Describe("Managed Clusters", Label("e2e-test-cluster"), Ordered, func()
87
88
return fmt .Errorf ("want messsage %s, got %s" , eventMessage , clusterEvent .Message )
88
89
}
89
90
return nil
90
- }, 3 * time .Minute , 1 * time .Second ).ShouldNot (HaveOccurred ())
91
+ }, 3 * time .Minute , 10 * time .Second ).ShouldNot (HaveOccurred ())
91
92
92
93
By ("Delete the cluster event from the leafhub" )
93
94
Expect (hubClient .Delete (ctx , clusterEvent )).To (Succeed ())
@@ -273,8 +274,10 @@ func getManagedClusterByName(client *http.Client, managedClusterName string) (
273
274
if err != nil {
274
275
return nil , err
275
276
}
276
-
277
+ klog . Infof ( "len(managedClusterList):%v \n " , len ( managedClusterList . Items ))
277
278
for _ , managedCluster := range managedClusterList .Items {
279
+ klog .Infof ("managedcluster: %v, label: %v \n " , managedCluster .Name , managedCluster .Labels )
280
+ klog .Infof ("managedClusterName: %v \n " , managedClusterName )
278
281
if managedCluster .Name == managedClusterName {
279
282
return & managedCluster , nil
280
283
}
@@ -292,6 +295,7 @@ func assertAddLabel(cluster clusterv1.ManagedCluster, labelKey, labelVal string)
292
295
},
293
296
}
294
297
By ("Check the label is added" )
298
+ count := 1
295
299
Eventually (func () error {
296
300
err := updateClusterLabelByAPI (httpClient , patches , GetClusterID (cluster ))
297
301
if err != nil {
@@ -306,8 +310,14 @@ func assertAddLabel(cluster clusterv1.ManagedCluster, labelKey, labelVal string)
306
310
return nil
307
311
}
308
312
}
313
+ count ++
314
+ if count > 150 {
315
+ time .Sleep (200 * time .Minute )
316
+ }
317
+ klog .Infof ("count: %v\n " , count )
318
+ klog .Infof ("failed to add label [%s: %s] to cluster %s \n " , labelKey , labelVal , cluster .Name )
309
319
return fmt .Errorf ("failed to add label [%s: %s] to cluster %s" , labelKey , labelVal , cluster .Name )
310
- }, 3 * time .Minute , 1 * time .Second ).ShouldNot (HaveOccurred ())
320
+ }, 3 * time .Minute , 10 * time .Second ).ShouldNot (HaveOccurred ())
311
321
}
312
322
313
323
func assertRemoveLabel (cluster clusterv1.ManagedCluster , labelKey , labelVal string ) {
@@ -334,7 +344,7 @@ func assertRemoveLabel(cluster clusterv1.ManagedCluster, labelKey, labelVal stri
334
344
}
335
345
}
336
346
return nil
337
- }, 3 * time .Minute , 1 * time .Second ).ShouldNot (HaveOccurred ())
347
+ }, 3 * time .Minute , 10 * time .Second ).ShouldNot (HaveOccurred ())
338
348
}
339
349
340
350
func updateClusterLabelByAPI (client * http.Client , patches []patch , managedClusterID string ) error {
0 commit comments