-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
194 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM mcr.microsoft.com/dotnet/runtime:8.0 | ||
|
||
RUN apt-get update | ||
RUN apt-get -y install fuse-zip | ||
|
||
WORKDIR /tst | ||
|
||
COPY ZippedOnWindows.zip . | ||
COPY run-test.sh . | ||
|
||
RUN chmod +x run-test.sh | ||
RUN mkdir mnt | ||
|
||
ENTRYPOINT ["./run-test.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace Azure.Functions.Cli.Tests; | ||
|
||
internal static class ProcessWrapper | ||
{ | ||
public static void RunProcess(string fileName, string arguments, string workingDirectory, Action<string> writeOutput = null, Action<string> writeError = null) | ||
{ | ||
TimeSpan procTimeout = TimeSpan.FromMinutes(3); | ||
|
||
ProcessStartInfo startInfo = new() | ||
{ | ||
CreateNoWindow = true, | ||
UseShellExecute = false, | ||
WorkingDirectory = workingDirectory, | ||
FileName = fileName, | ||
RedirectStandardError = true, | ||
RedirectStandardOutput = true, | ||
}; | ||
|
||
if (!string.IsNullOrEmpty(arguments)) | ||
{ | ||
startInfo.Arguments = arguments; | ||
} | ||
|
||
Process testProcess = Process.Start(startInfo); | ||
|
||
bool completed = testProcess.WaitForExit((int)procTimeout.TotalMilliseconds); | ||
|
||
if (!completed) | ||
{ | ||
testProcess.Kill(); | ||
throw new TimeoutException($"Process '{fileName} {arguments}' in working directory '{workingDirectory}' did not complete in {procTimeout}."); | ||
} | ||
|
||
var standardOut = testProcess.StandardOutput.ReadToEnd(); | ||
var standardError = testProcess.StandardError.ReadToEnd(); | ||
|
||
if (testProcess.ExitCode != 0) | ||
{ | ||
throw new InvalidOperationException($"Process '{fileName} {arguments}' in working directory '{workingDirectory}' exited with code '{testProcess.ExitCode}'.{Environment.NewLine}" + | ||
$"Output:{Environment.NewLine}{standardOut}{Environment.NewLine}Error:{Environment.NewLine}{standardError}"); | ||
} | ||
|
||
writeOutput?.Invoke(standardOut); | ||
writeError?.Invoke(standardError); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /bin/bash | ||
|
||
# this is what our hosting environment does; we need to validate we can run the exe when mounted like this | ||
fuse-zip ./ZippedOnWindows.zip ./mnt -r | ||
|
||
# print out directory for debugging | ||
cd ./mnt | ||
ls -l | ||
|
||
# run the exe to make sure it works | ||
./ZippedExe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters