From a3adeaf8befd4d81d7ee2d94c0ef147be9828a2e Mon Sep 17 00:00:00 2001 From: Lilian Kasem Date: Fri, 14 Nov 2025 11:11:52 -0800 Subject: [PATCH 1/2] Update working directory --- test/Cli/Func.E2ETests/BaseE2ETests.cs | 9 +++++++-- .../Commands/FuncInit/DotnetIsolatedInitTests.cs | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/Cli/Func.E2ETests/BaseE2ETests.cs b/test/Cli/Func.E2ETests/BaseE2ETests.cs index 90f7c8e3e..752b16bd4 100644 --- a/test/Cli/Func.E2ETests/BaseE2ETests.cs +++ b/test/Cli/Func.E2ETests/BaseE2ETests.cs @@ -60,9 +60,14 @@ public Task DisposeAsync() return Task.CompletedTask; } - public async Task FuncInitWithRetryAsync(string testName, IEnumerable args) + public async Task FuncInitWithRetryAsync(string testName, IEnumerable args, string? workingDir = null) { - await FunctionAppSetupHelper.FuncInitWithRetryAsync(FuncPath, testName, WorkingDirectory, Log, args); + if (workingDir is null) + { + workingDir = WorkingDirectory; + } + + await FunctionAppSetupHelper.FuncInitWithRetryAsync(FuncPath, testName, workingDir, Log, args); } public async Task FuncNewWithRetryAsync(string testName, IEnumerable args, string? workerRuntime = null) diff --git a/test/Cli/Func.E2ETests/Commands/FuncInit/DotnetIsolatedInitTests.cs b/test/Cli/Func.E2ETests/Commands/FuncInit/DotnetIsolatedInitTests.cs index fbe5413b6..a20390865 100644 --- a/test/Cli/Func.E2ETests/Commands/FuncInit/DotnetIsolatedInitTests.cs +++ b/test/Cli/Func.E2ETests/Commands/FuncInit/DotnetIsolatedInitTests.cs @@ -129,23 +129,23 @@ public void Init_WithTargetFrameworkAndDockerFlag_GeneratesDockerFile(string tar public async void Init_DockerOnlyOnExistingProjectWithTargetFramework_GeneratesDockerfile(string targetFramework) { var workingDir = Path.Combine(WorkingDirectory, targetFramework); + var targetFrameworkString = targetFramework.Replace("net", string.Empty); + var testName = nameof(Init_DockerOnlyOnExistingProjectWithTargetFramework_GeneratesDockerfile); + var expectedDockerfileContent = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated{targetFrameworkString}" }; try { - var targetFrameworkstr = targetFramework.Replace("net", string.Empty); FileSystemHelpers.EnsureDirectory(workingDir); - var testName = nameof(Init_DockerOnlyOnExistingProjectWithTargetFramework_GeneratesDockerfile); - var funcInitCommand = new FuncInitCommand(FuncPath, testName, Log ?? throw new ArgumentNullException(nameof(Log))); var dockerFilePath = Path.Combine(workingDir, "Dockerfile"); - var expectedDockerfileContent = new[] { $"FROM mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated{targetFrameworkstr}" }; var filesToValidate = new List<(string FilePath, string[] ExpectedContent)> { (dockerFilePath, expectedDockerfileContent) }; // Initialize dotnet-isolated function app using retry helper - await FuncInitWithRetryAsync(testName, [".", "--worker-runtime", "dotnet-isolated", "--target-framework", targetFramework]); + await FuncInitWithRetryAsync(testName, [".", "--worker-runtime", "dotnet-isolated", "--target-framework", targetFramework], workingDir); + var funcInitCommand = new FuncInitCommand(FuncPath, testName, Log ?? throw new ArgumentNullException(nameof(Log))); var funcInitResult = funcInitCommand .WithWorkingDirectory(workingDir) .Execute(["--docker-only"]); From 9db04abaa6cb8cc7d523818b186b19c6ca6332c1 Mon Sep 17 00:00:00 2001 From: Lilian Kasem Date: Mon, 17 Nov 2025 14:18:11 -0800 Subject: [PATCH 2/2] Update windows only test to SkippableFact --- .../Func.E2ETests/Commands/FuncPack/PythonPackTests.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/Cli/Func.E2ETests/Commands/FuncPack/PythonPackTests.cs b/test/Cli/Func.E2ETests/Commands/FuncPack/PythonPackTests.cs index 6119c2d64..d4d31eecc 100644 --- a/test/Cli/Func.E2ETests/Commands/FuncPack/PythonPackTests.cs +++ b/test/Cli/Func.E2ETests/Commands/FuncPack/PythonPackTests.cs @@ -135,14 +135,11 @@ public void Pack_PythonFromCache_WorksAsExpected() thirdPackResult.Should().FilesExistsWithExpectContent(packFilesToValidate); } - [Fact] + [SkippableFact] public void Pack_Python_BuildNativeDeps_OnWindows_WorksAsExpected() { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - { - // Only validate this scenario on Linux since linux based docker image is required - return; - } + // Only validate this scenario on Linux since linux based docker image is required + Skip.If(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows), "This test is only valid on Windows OS."); var testName = nameof(Pack_Python_BuildNativeDeps_OnWindows_WorksAsExpected);