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 @@ +