Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/Cli/Func.E2ETests/BaseE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ public Task DisposeAsync()
return Task.CompletedTask;
}

public async Task FuncInitWithRetryAsync(string testName, IEnumerable<string> args)
public async Task FuncInitWithRetryAsync(string testName, IEnumerable<string> 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<string> args, string? workerRuntime = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
9 changes: 3 additions & 6 deletions test/Cli/Func.E2ETests/Commands/FuncPack/PythonPackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading