From 3b01e6e809e32b79c1f11059b5f073112bab5c4a Mon Sep 17 00:00:00 2001 From: Logan Bussell Date: Tue, 5 Nov 2024 17:30:49 -0800 Subject: [PATCH] Run globalization tests on aspnet images --- .../AspnetImageTests.cs | 5 +++++ .../CommonRuntimeImageTests.cs | 17 +++++++++++++++++ .../RuntimeImageTests.cs | 16 ++-------------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/tests/Microsoft.DotNet.Docker.Tests/AspnetImageTests.cs b/tests/Microsoft.DotNet.Docker.Tests/AspnetImageTests.cs index 2539c58c3c..39d0185868 100644 --- a/tests/Microsoft.DotNet.Docker.Tests/AspnetImageTests.cs +++ b/tests/Microsoft.DotNet.Docker.Tests/AspnetImageTests.cs @@ -30,6 +30,11 @@ public async Task VerifyFxDependentAppScenario(ProductImageData imageData) await scenario.ExecuteAsync(); } + [DotNetTheory] + [MemberData(nameof(GetImageData))] + public async Task VerifyGlobalizationScenario(ProductImageData imageData) => + await VerifyGlobalizationScenarioBase(imageData); + [DotNetTheory] [MemberData(nameof(GetImageData))] public void VerifyEnvironmentVariables(ProductImageData imageData) diff --git a/tests/Microsoft.DotNet.Docker.Tests/CommonRuntimeImageTests.cs b/tests/Microsoft.DotNet.Docker.Tests/CommonRuntimeImageTests.cs index eaf22406ce..55e95af72c 100644 --- a/tests/Microsoft.DotNet.Docker.Tests/CommonRuntimeImageTests.cs +++ b/tests/Microsoft.DotNet.Docker.Tests/CommonRuntimeImageTests.cs @@ -5,8 +5,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; +using Microsoft.DotNet.Docker.Tests.TestScenarios; namespace Microsoft.DotNet.Docker.Tests { @@ -79,5 +81,20 @@ protected void VerifyCommonShellNotInstalledForDistroless(ProductImageData image Assert.Contains("Exit code: 127", ex.Message); } + + protected async Task VerifyGlobalizationScenarioBase(ProductImageData imageData) + { + // Inclusion of tzdata and icu together was not consistent in .NET 6, so skip the test. + // Remove once .NET 6 is EOL. + if (imageData.Version.Major == 6) + { + return; + } + + using (GlobalizationScenario testScenario = new(imageData, ImageRepo, DockerHelper)) + { + await testScenario.ExecuteAsync(); + } + } } } diff --git a/tests/Microsoft.DotNet.Docker.Tests/RuntimeImageTests.cs b/tests/Microsoft.DotNet.Docker.Tests/RuntimeImageTests.cs index 5f8d6a4fdb..f6fb89ad93 100644 --- a/tests/Microsoft.DotNet.Docker.Tests/RuntimeImageTests.cs +++ b/tests/Microsoft.DotNet.Docker.Tests/RuntimeImageTests.cs @@ -44,20 +44,8 @@ public async Task VerifyTestProjectScenario(ProductImageData imageData) [DotNetTheory] [MemberData(nameof(GetImageData))] - public async Task VerifyGlobalizationScenario(ProductImageData imageData) - { - // Inclusion of tzdata and icu together was not consistent in .NET 6, so skip the test. - // Remove once .NET 6 is EOL. - if (imageData.Version.Major == 6) - { - return; - } - - using (GlobalizationScenario testScenario = new(imageData, ImageRepo, DockerHelper)) - { - await testScenario.ExecuteAsync(); - } - } + public async Task VerifyGlobalizationScenario(ProductImageData imageData) => + await VerifyGlobalizationScenarioBase(imageData); [DotNetTheory] [MemberData(nameof(GetImageData))]