Fix Nano server tests to copy the dotnet runtime only when RUN_TESTS_ON_NANO environment variable is true
This commit is contained in:
parent
22175e03a7
commit
720289a539
|
|
@ -84,8 +84,18 @@ namespace E2ETests
|
||||||
// Copies dotnet runtime to the target server's file share.
|
// Copies dotnet runtime to the target server's file share.
|
||||||
public class DotnetRuntimeSetupTestFixture : IDisposable
|
public class DotnetRuntimeSetupTestFixture : IDisposable
|
||||||
{
|
{
|
||||||
|
private bool copiedDotnetRuntime;
|
||||||
|
|
||||||
public DotnetRuntimeSetupTestFixture()
|
public DotnetRuntimeSetupTestFixture()
|
||||||
{
|
{
|
||||||
|
var runNanoServerTests = Environment.GetEnvironmentVariable("RUN_TESTS_ON_NANO");
|
||||||
|
if (string.IsNullOrWhiteSpace(runNanoServerTests)
|
||||||
|
|| string.IsNullOrEmpty(runNanoServerTests)
|
||||||
|
|| runNanoServerTests.ToLower() == "false")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RemoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
RemoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
||||||
|
|
||||||
DotnetRuntimePathOnShare = Path.Combine(RemoteDeploymentConfig.FileSharePath, "dotnet");
|
DotnetRuntimePathOnShare = Path.Combine(RemoteDeploymentConfig.FileSharePath, "dotnet");
|
||||||
|
|
@ -117,6 +127,7 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipFile.ExtractToDirectory(ZippedDotnetRuntimePathOnShare, DotnetRuntimePathOnShare);
|
ZipFile.ExtractToDirectory(ZippedDotnetRuntimePathOnShare, DotnetRuntimePathOnShare);
|
||||||
|
copiedDotnetRuntime = true;
|
||||||
Console.WriteLine($"Extracted dotnet runtime to folder '{DotnetRuntimePathOnShare}'");
|
Console.WriteLine($"Extracted dotnet runtime to folder '{DotnetRuntimePathOnShare}'");
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrEmpty(RemoteDeploymentConfig.DotnetRuntimeFolderPath))
|
else if (!string.IsNullOrEmpty(RemoteDeploymentConfig.DotnetRuntimeFolderPath))
|
||||||
|
|
@ -131,6 +142,7 @@ namespace E2ETests
|
||||||
Console.WriteLine("This could take some time.");
|
Console.WriteLine("This could take some time.");
|
||||||
|
|
||||||
DirectoryCopy(RemoteDeploymentConfig.DotnetRuntimeFolderPath, DotnetRuntimePathOnShare, copySubDirs: true);
|
DirectoryCopy(RemoteDeploymentConfig.DotnetRuntimeFolderPath, DotnetRuntimePathOnShare, copySubDirs: true);
|
||||||
|
copiedDotnetRuntime = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -182,6 +194,11 @@ namespace E2ETests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
if (!copiedDotnetRuntime)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// In case the source is provided as a folder itself, then we wouldn't have the zip file to begin with.
|
// In case the source is provided as a folder itself, then we wouldn't have the zip file to begin with.
|
||||||
if (!string.IsNullOrEmpty(ZippedDotnetRuntimePathOnShare))
|
if (!string.IsNullOrEmpty(ZippedDotnetRuntimePathOnShare))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue