diff --git a/Directory.Packages.props b/Directory.Packages.props
index 8567e2106..a7869ce42 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -17,7 +17,7 @@
-
+
diff --git a/tests/E2E.Tests/MinikubeTests.cs b/tests/E2E.Tests/MinikubeTests.cs
index 5152ed24f..dc5a89b5c 100644
--- a/tests/E2E.Tests/MinikubeTests.cs
+++ b/tests/E2E.Tests/MinikubeTests.cs
@@ -752,23 +752,25 @@ await clientSet.CoreV1.Pod
// replace + get (retry on conflict due to Kubernetes optimistic concurrency)
{
- var retries = 5;
- while (retries-- > 0)
+ const int maxAttempts = 5;
+ var updated = false;
+ for (var attempt = 1; attempt <= maxAttempts; attempt++)
{
+ var pod = await clientSet.CoreV1.Pod.GetAsync(podName, namespaceParameter).ConfigureAwait(false);
+ pod.Spec.Containers[0].Image = "httpd";
try
{
- var pod = await clientSet.CoreV1.Pod.GetAsync(podName, namespaceParameter).ConfigureAwait(false);
- pod.Spec.Containers[0].Image = "httpd";
await clientSet.CoreV1.Pod.UpdateAsync(pod, podName, namespaceParameter).ConfigureAwait(false);
+ updated = true;
break;
}
- catch (HttpOperationException e) when (e.Response.StatusCode == System.Net.HttpStatusCode.Conflict)
+ catch (HttpOperationException e) when (e.Response.StatusCode == System.Net.HttpStatusCode.Conflict && attempt < maxAttempts)
{
- if (retries == 0) throw;
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
}
}
+ Assert.True(updated, "Failed to update pod after retries due to conflicts.");
var updatedPod = await clientSet.CoreV1.Pod.GetAsync(podName, namespaceParameter).ConfigureAwait(false);
Assert.Equal("httpd", updatedPod.Spec.Containers[0].Image);
}