diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs index 43b766d65c1a..ad5d2b8fe905 100644 --- a/test/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs +++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/CreateNewImageTests.cs @@ -20,7 +20,7 @@ public CreateNewImageTests(ITestOutputHelper testOutput) _testOutput = testOutput; } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public void CreateNewImage_Baseline() { DirectoryInfo newProjectDir = new(GetTestDirectoryName()); @@ -70,7 +70,7 @@ private static ImageConfig GetImageConfigFromTask(CreateNewImage task) return new(task.GeneratedContainerConfiguration); } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public void ParseContainerProperties_EndToEnd() { DirectoryInfo newProjectDir = new(GetTestDirectoryName()); @@ -133,7 +133,7 @@ public void ParseContainerProperties_EndToEnd() /// /// Creates a console app that outputs the environment variable added to the image. /// - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() { DirectoryInfo newProjectDir = new(GetTestDirectoryName()); @@ -151,6 +151,8 @@ public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() .Execute() .Should().Pass(); + EndToEndTests.ChangeTargetFrameworkAfterAppCreation(newProjectDir.FullName); + File.WriteAllText(Path.Combine(newProjectDir.FullName, "Program.cs"), $"Console.Write(Environment.GetEnvironmentVariable(\"GoodEnvVar\"));"); new DotnetCommand(_testOutput, "build", "--configuration", "release", "/p:runtimeidentifier=linux-x64", $"/p:RuntimeFrameworkVersion={DockerRegistryManager.RuntimeFrameworkVersion}") @@ -191,7 +193,7 @@ public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() cni.BaseImageTag = pcp.ParsedContainerTag; cni.Repository = pcp.NewContainerRepository; cni.OutputRegistry = pcp.NewContainerRegistry; - cni.PublishDirectory = Path.Combine(newProjectDir.FullName, "bin", "release", ToolsetInfo.CurrentTargetFramework, "linux-x64"); + cni.PublishDirectory = Path.Combine(newProjectDir.FullName, "bin", "release", EndToEndTests._oldFramework, "linux-x64"); cni.WorkingDirectory = "/app"; cni.Entrypoint = new TaskItem[] { new($"/app/{newProjectDir.Name}") }; cni.ImageTags = pcp.NewContainerTags; @@ -216,7 +218,7 @@ public void Tasks_EndToEnd_With_EnvironmentVariable_Validation() .And.HaveStdOut("Foo"); } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public async System.Threading.Tasks.Task CreateNewImage_RootlessBaseImage() { const string RootlessBase = "dotnet/rootlessbase"; diff --git a/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs b/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs index 717421b9dd83..2e4d8d469fb0 100644 --- a/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs +++ b/test/Microsoft.NET.Build.Containers.IntegrationTests/EndToEndTests.cs @@ -38,7 +38,20 @@ public void Dispose() _loggerFactory.Dispose(); } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + internal static readonly string _oldFramework = "net9.0"; + // CLI will not let us to target net9.0 anymore but we still need it because images for net10.0 aren't ready yet. + // so we let it create net10.0 app, then change the target. Since we're building just small sample applications, it works. + internal static void ChangeTargetFrameworkAfterAppCreation(string path) + { + DirectoryInfo d = new DirectoryInfo(path); + FileInfo[] Files = d.GetFiles("*.csproj"); //Getting .csproj files + string csprojFilename = Files[0].Name; // There is only one + string text = File.ReadAllText(Path.Combine(path, csprojFilename)); + text = text.Replace("net10.0", _oldFramework); + File.WriteAllText(Path.Combine(path, csprojFilename), text); + } + + [DockerAvailableFact] public async Task ApiEndToEndWithRegistryPushAndPull() { ILogger logger = _loggerFactory.CreateLogger(nameof(ApiEndToEndWithRegistryPushAndPull)); @@ -85,7 +98,7 @@ public async Task ApiEndToEndWithRegistryPushAndPull() } } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public async Task ApiEndToEndWithLocalLoad() { ILogger logger = _loggerFactory.CreateLogger(nameof(ApiEndToEndWithLocalLoad)); @@ -126,7 +139,7 @@ public async Task ApiEndToEndWithLocalLoad() } } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public async Task ApiEndToEndWithArchiveWritingAndLoad() { ILogger logger = _loggerFactory.CreateLogger(nameof(ApiEndToEndWithArchiveWritingAndLoad)); @@ -193,8 +206,11 @@ private string BuildLocalApp([CallerMemberName] string testName = "TestName", st .Execute() .Should().Pass(); + ChangeTargetFrameworkAfterAppCreation(Path.Combine(TestSettings.TestArtifactsDirectory, testName, "MinimalTestApp")); + + var publishCommand = - new DotnetCommand(_testOutput, "publish", "-bl", "MinimalTestApp", "-r", rid, "-f", tfm, "-c", "Debug") + new DotnetCommand(_testOutput, "publish", "-bl", "MinimalTestApp", "-r", rid, "-f", _oldFramework, "-c", "Debug") .WithWorkingDirectory(workingDirectory); if (tfm == ToolsetInfo.CurrentTargetFramework) @@ -205,11 +221,11 @@ private string BuildLocalApp([CallerMemberName] string testName = "TestName", st publishCommand.Execute() .Should().Pass(); - string publishDirectory = Path.Join(workingDirectory, "MinimalTestApp", "bin", "Debug", tfm, rid, "publish"); + string publishDirectory = Path.Join(workingDirectory, "MinimalTestApp", "bin", "Debug", _oldFramework, rid, "publish"); return publishDirectory; } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public async Task EndToEnd_MultiProjectSolution() { ILogger logger = _loggerFactory.CreateLogger(nameof(EndToEnd_MultiProjectSolution)); @@ -262,7 +278,7 @@ public async Task EndToEnd_MultiProjectSolution() document .Descendants() .First(e => e.Name.LocalName == "TargetFramework") - .Value = ToolsetInfo.CurrentTargetFramework; + .Value = _oldFramework; stream.SetLength(0); await document.SaveAsync(stream, SaveOptions.None, CancellationToken.None); @@ -275,7 +291,7 @@ public async Task EndToEnd_MultiProjectSolution() document .Descendants() .First(e => e.Name.LocalName == "TargetFramework") - .Value = ToolsetInfo.CurrentTargetFramework; + .Value = _oldFramework; stream.SetLength(0); await document.SaveAsync(stream, SaveOptions.None, CancellationToken.None); @@ -291,7 +307,7 @@ public async Task EndToEnd_MultiProjectSolution() commandResult.Should().HaveStdOutContaining("Pushed image 'consoleapp:latest'"); } - [DockerAvailableTheory(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableTheory(Skip = "https://github.com/dotnet/sdk/issues/45181")] [InlineData("webapi", false)] [InlineData("webapi", true)] [InlineData("worker", false)] @@ -313,7 +329,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage newProjectDir.Create(); privateNuGetAssets.Create(); - new DotnetNewCommand(_testOutput, projectType, "-f", ToolsetInfo.CurrentTargetFramework) .WithVirtualHive() .WithWorkingDirectory(newProjectDir.FullName) @@ -399,7 +414,6 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage processResult.Should().Pass(); Assert.NotNull(processResult.StdOut); string appContainerId = processResult.StdOut.Trim(); - bool everSucceeded = false; @@ -468,7 +482,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage privateNuGetAssets.Delete(true); } - [DockerAvailableFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableFact] public void EndToEnd_NoAPI_Console() { DirectoryInfo newProjectDir = new(Path.Combine(TestSettings.TestArtifactsDirectory, "CreateNewImageTest")); @@ -494,6 +508,7 @@ public void EndToEnd_NoAPI_Console() .WithEnvironmentVariable("NUGET_PACKAGES", privateNuGetAssets.FullName) .Execute() .Should().Pass(); + ChangeTargetFrameworkAfterAppCreation(newProjectDir.FullName); File.Copy(Path.Combine(TestContext.Current.TestExecutionDirectory, "NuGet.config"), Path.Combine(newProjectDir.FullName, "NuGet.config")); @@ -506,7 +521,7 @@ public void EndToEnd_NoAPI_Console() .Should().Pass(); // Add package to the project - new DotnetCommand(_testOutput, "add", "package", "Microsoft.NET.Build.Containers", "-f", ToolsetInfo.CurrentTargetFramework, "-v", packageVersion) + new DotnetCommand(_testOutput, "add", "package", "Microsoft.NET.Build.Containers", "-f", _oldFramework , "-v", packageVersion) .WithEnvironmentVariable("NUGET_PACKAGES", privateNuGetAssets.FullName) .WithWorkingDirectory(newProjectDir.FullName) .Execute() @@ -555,7 +570,7 @@ public void EndToEnd_NoAPI_Console() [DockerSupportsArchInlineData("linux/386", "linux-x86", "/app", Skip = "There's no apphost for linux-x86 so we can't execute self-contained, and there's no .NET runtime base image for linux-x86 so we can't execute framework-dependent.")] [DockerSupportsArchInlineData("windows/amd64", "win-x64", "C:\\app")] [DockerSupportsArchInlineData("linux/amd64", "linux-x64", "/app")] - [DockerAvailableTheory(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [DockerAvailableTheory] public async Task CanPackageForAllSupportedContainerRIDs(string dockerPlatform, string rid, string workingDir) { ILogger logger = _loggerFactory.CreateLogger(nameof(CanPackageForAllSupportedContainerRIDs)); diff --git a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs index 68e14a7b3eb8..0a138e01a9f6 100644 --- a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs +++ b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Watcher.Tests { public class ApplyDeltaTests(ITestOutputHelper logger) : DotNetWatchTestBase(logger) { - [Fact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [Fact] public async Task AddSourceFile() { Logger.WriteLine("AddSourceFile started"); @@ -43,7 +43,7 @@ public static void Print() await App.AssertOutputLineStartsWith("Changed!"); } - [Fact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [Fact] public async Task ChangeFileInDependency() { var testAsset = TestAssets.CopyTestAsset("WatchAppWithProjectDeps") @@ -69,7 +69,7 @@ public static void Print() } // Test is timing out on .NET Framework: https://github.com/dotnet/sdk/issues/41669 - [CoreMSBuildOnlyFact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [CoreMSBuildOnlyFact] public async Task HandleTypeLoadFailure() { var testAsset = TestAssets.CopyTestAsset("WatchAppTypeLoadFailure") @@ -206,7 +206,7 @@ public async Task BlazorWasm() //await App.AssertOutputLineStartsWith(MessageDescriptor.HotReloadSucceeded); } - [Fact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [Fact] public async Task BlazorWasm_MSBuildWarning() { var testAsset = TestAssets diff --git a/test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs b/test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs index fd7ad999968a..3187af62bf10 100644 --- a/test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs +++ b/test/dotnet-watch.Tests/HotReload/CompilationHandlerTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Watcher.Tests; public class CompilationHandlerTests(ITestOutputHelper logger) : DotNetWatchTestBase(logger) { - [Fact(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [Fact] public async Task ReferenceOutputAssembly_False() { var testAsset = TestAssets.CopyTestAsset("WatchAppMultiProc") diff --git a/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs b/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs index 6c6c7a8c0e3f..f56d7bcc42eb 100644 --- a/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs +++ b/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs @@ -225,7 +225,7 @@ async Task MakeRudeEditChange() } } - [Theory(Skip = "https://github.com/dotnet/sdk/issues/42850")] + [Theory] [CombinatorialData] public async Task UpdateAppliedToNewProcesses(bool sharedOutput) {