Code cleanup and added more log information

This commit is contained in:
Kiran Challa 2017-07-06 05:49:07 -07:00
Родитель bcabc64d9b
Коммит 2283ee8fcc
3 изменённых файлов: 32 добавлений и 17 удалений

Просмотреть файл

@ -66,7 +66,7 @@ namespace E2ETests
var packageId = "Build.RS";
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();
if (runtimeStoreLibrary == null)
{
@ -76,6 +76,8 @@ namespace E2ETests
var runtimeStoreVersion = runtimeStoreLibrary.Version;
var restoredRuntimeStorePackageDir = Path.Combine(GetNugetPackagesRoot(), runtimeStoreLibrary.Path);
_logger.LogInformation($"Location of the restored runtime store package '{packageId}': {restoredRuntimeStorePackageDir}");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
string fileNameWithExtension = null;
@ -119,10 +121,11 @@ namespace E2ETests
}
string fileNameWithExtension = null;
var tarFile = $"{packageIdPrefix}.tar.gz";
foreach (var file in new DirectoryInfo(restoredRuntimeStorePackageDir).GetFiles())
{
if (file.Name.StartsWith(packageIdPrefix)
&& !string.Equals($"{packageIdPrefix}.tar.gz", file.Name, StringComparison.OrdinalIgnoreCase))
&& !string.Equals(tarFile, file.Name, StringComparison.OrdinalIgnoreCase))
{
fileNameWithExtension = file.FullName;
break;
@ -132,9 +135,11 @@ namespace E2ETests
if (string.IsNullOrEmpty(fileNameWithExtension))
{
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);
var startInfo = new ProcessStartInfo()

Просмотреть файл

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
using Xunit;
using Xunit.Abstractions;
@ -53,15 +55,36 @@ namespace E2ETests.SmokeTestsUsingStore
{
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);
Assert.False(
File.Exists(mvcCoreDllPath),
$"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);
}
}
}
// 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,
_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);
}
}
}