wrap update config map in retry for conflicts
@@ -32,6 +32,7 @@ import (
"knative.dev/eventing/test/lib/cloudevents"
"knative.dev/eventing/test/lib/duck"
"knative.dev/eventing/test/lib/resources"
+ reconciler "knative.dev/pkg/reconciler"
)
const (
@@ -133,8 +134,9 @@ func defaultChannelTestHelper(t *testing.T, client *lib.Client, expectedChannel
// updateDefaultChannelCM will update the default channel configmap
func updateDefaultChannelCM(client *lib.Client, updateConfig func(config *config.ChannelDefaults)) error {
- systemNamespace := resources.SystemNamespace
- cmInterface := client.Kube.Kube.CoreV1().ConfigMaps(systemNamespace)
+ cmInterface := client.Kube.Kube.CoreV1().ConfigMaps(resources.SystemNamespace)
+
+ err := reconciler.RetryUpdateConflicts(func(attempts int) (err error) {
// get the defaultchannel configmap
configMap, err := cmInterface.Get(configMapName, metav1.GetOptions{})
if err != nil {
@@ -158,6 +160,8 @@ func updateDefaultChannelCM(client *lib.Client, updateConfig func(config *config
// update the defaultchannel configmap
configMap.Data[channelDefaulterKey] = string(configBytes)
_, err = cmInterface.Update(configMap)
+ return err
+ })
if err != nil {
return err
}
