Code cleanup and added more log information
This commit is contained in:
parent
bcabc64d9b
commit
2283ee8fcc
|
|
@ -66,7 +66,7 @@ namespace E2ETests
|
||||||
var packageId = "Build.RS";
|
var packageId = "Build.RS";
|
||||||
|
|
||||||
var runtimeStoreLibrary = DependencyContext.Default.RuntimeLibraries
|
var runtimeStoreLibrary = DependencyContext.Default.RuntimeLibraries
|
||||||
.Where(library => string.Equals("Build.RS", library.Name, StringComparison.OrdinalIgnoreCase))
|
.Where(library => string.Equals(packageId, library.Name, StringComparison.OrdinalIgnoreCase))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
if (runtimeStoreLibrary == null)
|
if (runtimeStoreLibrary == null)
|
||||||
{
|
{
|
||||||
|
|
@ -76,6 +76,8 @@ namespace E2ETests
|
||||||
var runtimeStoreVersion = runtimeStoreLibrary.Version;
|
var runtimeStoreVersion = runtimeStoreLibrary.Version;
|
||||||
var restoredRuntimeStorePackageDir = Path.Combine(GetNugetPackagesRoot(), runtimeStoreLibrary.Path);
|
var restoredRuntimeStorePackageDir = Path.Combine(GetNugetPackagesRoot(), runtimeStoreLibrary.Path);
|
||||||
|
|
||||||
|
_logger.LogInformation($"Location of the restored runtime store package '{packageId}': {restoredRuntimeStorePackageDir}");
|
||||||
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
string fileNameWithExtension = null;
|
string fileNameWithExtension = null;
|
||||||
|
|
@ -119,10 +121,11 @@ namespace E2ETests
|
||||||
}
|
}
|
||||||
|
|
||||||
string fileNameWithExtension = null;
|
string fileNameWithExtension = null;
|
||||||
|
var tarFile = $"{packageIdPrefix}.tar.gz";
|
||||||
foreach (var file in new DirectoryInfo(restoredRuntimeStorePackageDir).GetFiles())
|
foreach (var file in new DirectoryInfo(restoredRuntimeStorePackageDir).GetFiles())
|
||||||
{
|
{
|
||||||
if (file.Name.StartsWith(packageIdPrefix)
|
if (file.Name.StartsWith(packageIdPrefix)
|
||||||
&& !string.Equals($"{packageIdPrefix}.tar.gz", file.Name, StringComparison.OrdinalIgnoreCase))
|
&& !string.Equals(tarFile, file.Name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
fileNameWithExtension = file.FullName;
|
fileNameWithExtension = file.FullName;
|
||||||
break;
|
break;
|
||||||
|
|
@ -132,9 +135,11 @@ namespace E2ETests
|
||||||
if (string.IsNullOrEmpty(fileNameWithExtension))
|
if (string.IsNullOrEmpty(fileNameWithExtension))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
$"Could not find a store zip file with version {runtimeStoreVersion}");
|
$"Could not find a store tar file with version {runtimeStoreVersion}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation($"Extracting the store tar file '{fileNameWithExtension}' to '{storeParentDir}' ...");
|
||||||
|
|
||||||
Directory.CreateDirectory(storeParentDir);
|
Directory.CreateDirectory(storeParentDir);
|
||||||
|
|
||||||
var startInfo = new ProcessStartInfo()
|
var startInfo = new ProcessStartInfo()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging.Testing;
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
@ -53,15 +55,36 @@ namespace E2ETests.SmokeTestsUsingStore
|
||||||
{
|
{
|
||||||
var deploymentResult = await deployer.DeployAsync();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
|
||||||
var mvcCoreDllPath = Path.Combine(deploymentResult.ContentRoot, "Microsoft.AspNetCore.Mvc.Core.dll");
|
logger.LogInformation("Published output directory structure:");
|
||||||
|
logger.LogInformation(GetDirectoryStructure(deploymentResult.ContentRoot));
|
||||||
|
|
||||||
|
var mvcCoreDll = "Microsoft.AspNetCore.Mvc.Core.dll";
|
||||||
|
logger.LogInformation(
|
||||||
|
$"Checking if published output was trimmed by verifying that the dll '{mvcCoreDll}' is not present...");
|
||||||
|
|
||||||
|
var mvcCoreDllPath = Path.Combine(deploymentResult.ContentRoot, mvcCoreDll);
|
||||||
var fileInfo = new FileInfo(mvcCoreDllPath);
|
var fileInfo = new FileInfo(mvcCoreDllPath);
|
||||||
Assert.False(
|
Assert.False(
|
||||||
File.Exists(mvcCoreDllPath),
|
File.Exists(mvcCoreDllPath),
|
||||||
$"The file '{fileInfo.Name}.{fileInfo.Extension}' was not expected to be present in the publish directory");
|
$"The file '{fileInfo.Name}.{fileInfo.Extension}' was not expected to be present in the publish directory");
|
||||||
|
|
||||||
|
logger.LogInformation($"Published output does not have the dll '{mvcCoreDll}', so the output seems to be trimmed");
|
||||||
|
|
||||||
await SmokeTestRunner.RunTestsAsync(deploymentResult, logger);
|
await SmokeTestRunner.RunTestsAsync(deploymentResult, logger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the top level view of the published output directory
|
||||||
|
private string GetDirectoryStructure(string publishedOutputDir)
|
||||||
|
{
|
||||||
|
var directoryStructure = new StringBuilder();
|
||||||
|
var dir = new DirectoryInfo(publishedOutputDir);
|
||||||
|
foreach (var fileSystemInfo in dir.GetFileSystemInfos())
|
||||||
|
{
|
||||||
|
directoryStructure.AppendLine(fileSystemInfo.Name);
|
||||||
|
}
|
||||||
|
return directoryStructure.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,18 +29,5 @@ namespace E2ETests.SmokeTestsUsingStore
|
||||||
ServerType.Kestrel,
|
ServerType.Kestrel,
|
||||||
_testFixture.StoreDirectory);
|
_testFixture.StoreDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
|
||||||
[SkipIfEnvironmentVariableNotEnabled("RUN_RUNTIME_STORE_TESTS")]
|
|
||||||
[ConditionalFact]
|
|
||||||
[Trait("smoketests", "usestore")]
|
|
||||||
public async Task DefaultLocation_WebListener()
|
|
||||||
{
|
|
||||||
var tests = new TestHelper(_output);
|
|
||||||
await tests.SmokeTestSuite(
|
|
||||||
ServerType.WebListener,
|
|
||||||
_testFixture.StoreDirectory);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue