Skip to content

Commit d1f6d7a

Browse files
committed
E2E: retries in CopyConfigMap func
1 parent 945ee51 commit d1f6d7a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

test/e2e/cni.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func InstallCalicoHelmChart(ctx context.Context, input clusterctl.ApplyClusterTe
5555
workloadClusterClient := clusterProxy.GetClient()
5656

5757
// Copy the kubeadm configmap to the calico-system namespace. This is a workaround needed for the calico-node-windows daemonset to be able to run in the calico-system namespace.
58-
CopyConfigMap(ctx, workloadClusterClient, kubeadmConfigMapName, kubesystem, CalicoSystemNamespace)
58+
CopyConfigMap(ctx, input, workloadClusterClient, kubeadmConfigMapName, kubesystem, CalicoSystemNamespace)
5959

6060
By("Waiting for Ready tigera-operator deployment pods")
6161
for _, d := range []string{"tigera-operator"} {

test/e2e/helpers.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -986,14 +986,16 @@ func InstallHelmChart(ctx context.Context, input clusterctl.ApplyClusterTemplate
986986
}
987987
}
988988

989-
func CopyConfigMap(ctx context.Context, cl client.Client, cmName, fromNamespace, toNamespace string) {
989+
func CopyConfigMap(ctx context.Context, input clusterctl.ApplyClusterTemplateAndWaitInput, cl client.Client, cmName, fromNamespace, toNamespace string) {
990990
cm := &corev1.ConfigMap{}
991-
Expect(cl.Get(ctx, client.ObjectKey{Name: cmName, Namespace: fromNamespace}, cm)).To(Succeed())
992-
cm.SetNamespace(toNamespace)
993-
cm.SetResourceVersion("")
994-
framework.EnsureNamespace(ctx, cl, toNamespace)
995-
err := cl.Create(ctx, cm.DeepCopy())
996-
if !apierrors.IsAlreadyExists(err) {
997-
Expect(err).To(Succeed())
998-
}
991+
Eventually(func(g Gomega) {
992+
g.Expect(cl.Get(ctx, client.ObjectKey{Name: cmName, Namespace: fromNamespace}, cm)).To(Succeed())
993+
cm.SetNamespace(toNamespace)
994+
cm.SetResourceVersion("")
995+
framework.EnsureNamespace(ctx, cl, toNamespace)
996+
err := cl.Create(ctx, cm.DeepCopy())
997+
if !apierrors.IsAlreadyExists(err) {
998+
g.Expect(err).To(Succeed())
999+
}
1000+
}, input.WaitForControlPlaneIntervals...).Should(Succeed())
9991001
}

0 commit comments

Comments
 (0)