Updated store tests to work on linux an osx too
This commit is contained in:
parent
067cd90fef
commit
e780d31ce3
|
|
@ -19,19 +19,30 @@ namespace E2ETests
|
||||||
_output = output;
|
_output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
|
||||||
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
||||||
[ConditionalTheory]
|
[ConditionalFact]
|
||||||
[Trait("smoketests", "usestore")]
|
[Trait("smoketests", "usestore")]
|
||||||
[Trait("smoketests", "usestore-defaultlocation")]
|
[Trait("smoketests", "usestore-defaultlocation")]
|
||||||
[InlineData(ServerType.Kestrel)]
|
public async Task DefaultLocation_Kestrel()
|
||||||
[InlineData(ServerType.WebListener)]
|
|
||||||
public async Task DefaultLocation(ServerType serverType)
|
|
||||||
{
|
{
|
||||||
var tests = new SmokeTestsUsingStoreHelper(_output);
|
var tests = new SmokeTestsUsingStoreHelper(_output);
|
||||||
await tests.SmokeTestSuite(
|
await tests.SmokeTestSuite(
|
||||||
serverType,
|
ServerType.Kestrel,
|
||||||
|
_testFixture.CreateStoreInDefaultLocation,
|
||||||
|
_testFixture.StoreDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
|
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
||||||
|
[ConditionalFact]
|
||||||
|
[Trait("smoketests", "usestore")]
|
||||||
|
[Trait("smoketests", "usestore-defaultlocation")]
|
||||||
|
public async Task DefaultLocation_WebListener()
|
||||||
|
{
|
||||||
|
var tests = new SmokeTestsUsingStoreHelper(_output);
|
||||||
|
await tests.SmokeTestSuite(
|
||||||
|
ServerType.WebListener,
|
||||||
_testFixture.CreateStoreInDefaultLocation,
|
_testFixture.CreateStoreInDefaultLocation,
|
||||||
_testFixture.StoreDirectory);
|
_testFixture.StoreDirectory);
|
||||||
}
|
}
|
||||||
|
|
@ -50,19 +61,30 @@ namespace E2ETests
|
||||||
_output = output;
|
_output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
|
||||||
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
||||||
[ConditionalTheory]
|
[ConditionalFact]
|
||||||
[Trait("smoketests", "usestore")]
|
[Trait("smoketests", "usestore")]
|
||||||
[Trait("smoketests", "usestore-customlocation")]
|
[Trait("smoketests", "usestore-customlocation")]
|
||||||
[InlineData(ServerType.Kestrel)]
|
public async Task CustomLocation_Kestrel()
|
||||||
[InlineData(ServerType.WebListener)]
|
|
||||||
public async Task CustomLocation(ServerType serverType)
|
|
||||||
{
|
{
|
||||||
var tests = new SmokeTestsUsingStoreHelper(_output);
|
var tests = new SmokeTestsUsingStoreHelper(_output);
|
||||||
await tests.SmokeTestSuite(
|
await tests.SmokeTestSuite(
|
||||||
serverType,
|
ServerType.Kestrel,
|
||||||
|
_testFixture.CreateStoreInDefaultLocation,
|
||||||
|
_testFixture.StoreDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
|
[EnvironmentVariableSkipCondition(Store.MusicStoreAspNetCoreStoreFeed, null, SkipOnMatch = false)]
|
||||||
|
[ConditionalFact]
|
||||||
|
[Trait("smoketests", "usestore")]
|
||||||
|
[Trait("smoketests", "usestore-customlocation")]
|
||||||
|
public async Task CustomLocation_WebListener()
|
||||||
|
{
|
||||||
|
var tests = new SmokeTestsUsingStoreHelper(_output);
|
||||||
|
await tests.SmokeTestSuite(
|
||||||
|
ServerType.WebListener,
|
||||||
_testFixture.CreateStoreInDefaultLocation,
|
_testFixture.CreateStoreInDefaultLocation,
|
||||||
_testFixture.StoreDirectory);
|
_testFixture.StoreDirectory);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.Extensions.CommandLineUtils;
|
using Microsoft.Extensions.CommandLineUtils;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
@ -12,7 +14,6 @@ using NuGet.Packaging.Core;
|
||||||
using NuGet.Protocol;
|
using NuGet.Protocol;
|
||||||
using NuGet.Protocol.Core.Types;
|
using NuGet.Protocol.Core.Types;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace E2ETests
|
namespace E2ETests
|
||||||
{
|
{
|
||||||
|
|
@ -54,11 +55,11 @@ namespace E2ETests
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Deleting the store...");
|
_logger.LogInformation("Deleting the store...");
|
||||||
|
|
||||||
RetryHelper.RetryOperation(
|
//RetryHelper.RetryOperation(
|
||||||
() => Directory.Delete(_storeDir, recursive: true),
|
// () => Directory.Delete(_storeDir, recursive: true),
|
||||||
e => _logger.LogError($"Failed to delete directory : {e.Message}"),
|
// e => _logger.LogError($"Failed to delete directory : {e.Message}"),
|
||||||
retryCount: 3,
|
// retryCount: 3,
|
||||||
retryDelayMilliseconds: 100);
|
// retryDelayMilliseconds: 100);
|
||||||
|
|
||||||
RetryHelper.RetryOperation(
|
RetryHelper.RetryOperation(
|
||||||
() => Directory.Delete(_tempDir, recursive: true),
|
() => Directory.Delete(_tempDir, recursive: true),
|
||||||
|
|
@ -173,7 +174,56 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
string packageIdPrefix;
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
packageIdPrefix = $"{packageId}.linux";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packageIdPrefix = $"{packageId}.osx";
|
||||||
|
}
|
||||||
|
|
||||||
|
string fileNameWithExtension = null;
|
||||||
|
foreach (var file in new DirectoryInfo(zipFileExtracted).GetFiles())
|
||||||
|
{
|
||||||
|
if (file.Name.StartsWith(packageIdPrefix)
|
||||||
|
&& !string.Equals($"{packageIdPrefix}.tar.gz", file.Name, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
fileNameWithExtension = file.FullName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(fileNameWithExtension))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"Could not find a store zip file with version {assemblyInformationVersionAttribute.InformationalVersion}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(storeParentDir);
|
||||||
|
|
||||||
|
var startInfo = new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = "tar",
|
||||||
|
Arguments = $"xvzf {fileNameWithExtension}",
|
||||||
|
WorkingDirectory = storeParentDir,
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true,
|
||||||
|
RedirectStandardError = true,
|
||||||
|
RedirectStandardOutput = true,
|
||||||
|
RedirectStandardInput = true
|
||||||
|
};
|
||||||
|
var tarProcess = new Process() { StartInfo = startInfo };
|
||||||
|
tarProcess.EnableRaisingEvents = true;
|
||||||
|
tarProcess.StartAndCaptureOutAndErrToLogger("tar", _logger);
|
||||||
|
|
||||||
|
if (tarProcess.HasExited && tarProcess.ExitCode != 0)
|
||||||
|
{
|
||||||
|
var message = $"Error occurred while extracting the file '{fileNameWithExtension}' in working directory '{storeParentDir}'";
|
||||||
|
_logger.LogError(message);
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,15 +235,7 @@ namespace E2ETests
|
||||||
// On Windows: ..\.dotnet\x64\dotnet.exe
|
// On Windows: ..\.dotnet\x64\dotnet.exe
|
||||||
// On Linux : ../.dotnet/dotnet
|
// On Linux : ../.dotnet/dotnet
|
||||||
var dotnetDir = new FileInfo(DotNetMuxer.MuxerPath).Directory.FullName;
|
var dotnetDir = new FileInfo(DotNetMuxer.MuxerPath).Directory.FullName;
|
||||||
|
storeParentDir = dotnetDir;
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
storeParentDir = dotnetDir;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
storeParentDir = Path.Combine(dotnetDir, "x64");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue