From adad1f8d787dcf210d8f1f2f2910d90dadd2c814 Mon Sep 17 00:00:00 2001 From: "Ryan Brandenburg (He/Him)" Date: Thu, 17 Sep 2026 10:10:40 -0700 Subject: [PATCH] Docker Ping retry delay --- .../DockerServiceTests.cs | 6 +++++- .../Microsoft.ComponentDetection.Common.Tests.csproj | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.ComponentDetection.Common.Tests/DockerServiceTests.cs b/test/Microsoft.ComponentDetection.Common.Tests/DockerServiceTests.cs index 23be8fc12..b8ae3c34a 100644 --- a/test/Microsoft.ComponentDetection.Common.Tests/DockerServiceTests.cs +++ b/test/Microsoft.ComponentDetection.Common.Tests/DockerServiceTests.cs @@ -8,6 +8,7 @@ namespace Microsoft.ComponentDetection.Common.Tests; using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Polly; [TestClass] [TestCategory("Governance/All")] @@ -26,7 +27,10 @@ public class DockerServiceTests [TestMethod] public async Task DockerService_CanPingDockerAsync() { - var canPingDocker = await this.dockerService.CanPingDockerAsync(); + var canPingDocker = await Policy.HandleResult(result => !result) + .WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(5)) + .ExecuteAsync(() => this.dockerService.CanPingDockerAsync()); + canPingDocker.Should().BeTrue(); } diff --git a/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj b/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj index 496f5be8c..8d4ae758e 100644 --- a/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj +++ b/test/Microsoft.ComponentDetection.Common.Tests/Microsoft.ComponentDetection.Common.Tests.csproj @@ -9,6 +9,7 @@ +