react to aspnet/Hosting#996 (#769)
This commit is contained in:
parent
6922cbb903
commit
049ee03d22
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26206.0
|
VisualStudioVersion = 15.0.26228.10
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7D749BDA-4638-4517-B66A-D40DEDEEB141}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7D749BDA-4638-4517-B66A-D40DEDEEB141}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
|
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
|
||||||
<AspNetCoreLabsVersion>0.3.0-*</AspNetCoreLabsVersion>
|
<AspNetIntegrationTestingVersion>0.4.0-*</AspNetIntegrationTestingVersion>
|
||||||
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
|
<AspNetCoreModuleVersion>1.0.0-*</AspNetCoreModuleVersion>
|
||||||
<DotNetPlatformAbstractionsVersion>1.1.0</DotNetPlatformAbstractionsVersion>
|
<DotNetPlatformAbstractionsVersion>1.1.0</DotNetPlatformAbstractionsVersion>
|
||||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreLabsVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetIntegrationTestingVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(DotNetPlatformAbstractionsVersion)" />
|
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(DotNetPlatformAbstractionsVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="$(AspNetCoreVersion)" />
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(AspNetCoreVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="$(CoreFxVersion)" />
|
<PackageReference Include="System.Data.SqlClient" Version="$(CoreFxVersion)" />
|
||||||
<PackageReference Include="System.Xml.XmlDocument" Version="$(CoreFxVersion)" />
|
<PackageReference Include="System.Xml.XmlDocument" Version="$(CoreFxVersion)" />
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
For schema documentation, see
|
For schema documentation, see
|
||||||
%IIS_BIN%\config\schema\IIS_schema.xml.
|
%IIS_BIN%\config\schema\IIS_schema.xml.
|
||||||
|
|
||||||
Please make a backup of this file before making any changes to it.
|
Please make a backup of this file before making any changes to it.
|
||||||
|
|
||||||
NOTE: The following environment variables are available to be used
|
NOTE: The following environment variables are available to be used
|
||||||
|
|
@ -25,20 +25,20 @@
|
||||||
The <configSections> section controls the registration of sections.
|
The <configSections> section controls the registration of sections.
|
||||||
Section is the basic unit of deployment, locking, searching and
|
Section is the basic unit of deployment, locking, searching and
|
||||||
containment for configuration settings.
|
containment for configuration settings.
|
||||||
|
|
||||||
Every section belongs to one section group.
|
Every section belongs to one section group.
|
||||||
A section group is a container of logically-related sections.
|
A section group is a container of logically-related sections.
|
||||||
|
|
||||||
Sections cannot be nested.
|
Sections cannot be nested.
|
||||||
Section groups may be nested.
|
Section groups may be nested.
|
||||||
|
|
||||||
<section
|
<section
|
||||||
name="" [Required, Collection Key] [XML name of the section]
|
name="" [Required, Collection Key] [XML name of the section]
|
||||||
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
|
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
|
||||||
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
|
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
|
||||||
allowLocation="true" [true|false] [Allowed in location tags]
|
allowLocation="true" [true|false] [Allowed in location tags]
|
||||||
/>
|
/>
|
||||||
|
|
||||||
The recommended way to unlock sections is by using a location tag:
|
The recommended way to unlock sections is by using a location tag:
|
||||||
<location path="Default Web Site" overrideMode="Allow">
|
<location path="Default Web Site" overrideMode="Allow">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
For schema documentation, see
|
For schema documentation, see
|
||||||
%IIS_BIN%\config\schema\IIS_schema.xml.
|
%IIS_BIN%\config\schema\IIS_schema.xml.
|
||||||
|
|
||||||
Please make a backup of this file before making any changes to it.
|
Please make a backup of this file before making any changes to it.
|
||||||
|
|
||||||
NOTE: The following environment variables are available to be used
|
NOTE: The following environment variables are available to be used
|
||||||
|
|
@ -25,20 +25,20 @@
|
||||||
The <configSections> section controls the registration of sections.
|
The <configSections> section controls the registration of sections.
|
||||||
Section is the basic unit of deployment, locking, searching and
|
Section is the basic unit of deployment, locking, searching and
|
||||||
containment for configuration settings.
|
containment for configuration settings.
|
||||||
|
|
||||||
Every section belongs to one section group.
|
Every section belongs to one section group.
|
||||||
A section group is a container of logically-related sections.
|
A section group is a container of logically-related sections.
|
||||||
|
|
||||||
Sections cannot be nested.
|
Sections cannot be nested.
|
||||||
Section groups may be nested.
|
Section groups may be nested.
|
||||||
|
|
||||||
<section
|
<section
|
||||||
name="" [Required, Collection Key] [XML name of the section]
|
name="" [Required, Collection Key] [XML name of the section]
|
||||||
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
|
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
|
||||||
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
|
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
|
||||||
allowLocation="true" [true|false] [Allowed in location tags]
|
allowLocation="true" [true|false] [Allowed in location tags]
|
||||||
/>
|
/>
|
||||||
|
|
||||||
The recommended way to unlock sections is by using a location tag:
|
The recommended way to unlock sections is by using a location tag:
|
||||||
<location path="Default Web Site" overrideMode="Allow">
|
<location path="Default Web Site" overrideMode="Allow">
|
||||||
<system.webServer>
|
<system.webServer>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
|
@ -13,88 +13,96 @@ using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace E2ETests
|
namespace E2ETests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5050 - 5060.
|
|
||||||
public class NtlmAuthenticationTests : IDisposable
|
public class NtlmAuthenticationTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public NtlmAuthenticationTests(ITestOutputHelper output)
|
public NtlmAuthenticationTests(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5050/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5051/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5052/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5053/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
public async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl)
|
public async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
using (_logger.BeginScope("NtlmAuthenticationTest"))
|
try
|
||||||
{
|
{
|
||||||
var musicStoreDbName = DbUtils.GetUniqueName();
|
Console.WriteLine("NtlmAuthenticationTest");
|
||||||
|
var logger = _loggerFactory.CreateLogger($"NtlmAuthentication:{serverType}:{runtimeFlavor}:{architecture}:{applicationType}");
|
||||||
var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
using (logger.BeginScope("NtlmAuthenticationTest"))
|
||||||
{
|
{
|
||||||
PublishApplicationBeforeDeployment = true,
|
var musicStoreDbName = DbUtils.GetUniqueName();
|
||||||
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
|
||||||
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
||||||
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
|
||||||
ApplicationType = applicationType,
|
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
|
||||||
EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'
|
|
||||||
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null,
|
|
||||||
SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config
|
|
||||||
UserAdditionalCleanup = parameters =>
|
|
||||||
{
|
{
|
||||||
DbUtils.DropDatabase(musicStoreDbName, _logger);
|
PublishApplicationBeforeDeployment = true,
|
||||||
|
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
||||||
|
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
||||||
|
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
||||||
|
ApplicationType = applicationType,
|
||||||
|
EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'
|
||||||
|
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null,
|
||||||
|
SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config
|
||||||
|
UserAdditionalCleanup = parameters =>
|
||||||
|
{
|
||||||
|
DbUtils.DropDatabase(musicStoreDbName, logger);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (applicationType == ApplicationType.Standalone)
|
||||||
|
{
|
||||||
|
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (applicationType == ApplicationType.Standalone)
|
// Override the connection strings using environment based configuration
|
||||||
{
|
deploymentParameters.EnvironmentVariables
|
||||||
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
.Add(new KeyValuePair<string, string>(
|
||||||
}
|
MusicStoreConfig.ConnectionStringKey,
|
||||||
|
DbUtils.CreateConnectionString(musicStoreDbName)));
|
||||||
|
|
||||||
// Override the connection strings using environment based configuration
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory))
|
||||||
deploymentParameters.EnvironmentVariables
|
|
||||||
.Add(new KeyValuePair<string, string>(
|
|
||||||
MusicStoreConfig.ConnectionStringKey,
|
|
||||||
DbUtils.CreateConnectionString(musicStoreDbName)));
|
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger))
|
|
||||||
{
|
|
||||||
var deploymentResult = deployer.Deploy();
|
|
||||||
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
|
|
||||||
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) };
|
|
||||||
|
|
||||||
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
|
||||||
var response = await RetryHelper.RetryRequest(async () =>
|
|
||||||
{
|
{
|
||||||
return await httpClient.GetAsync(string.Empty);
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
}, logger: _logger, cancellationToken: deploymentResult.HostShutdownToken);
|
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
|
||||||
|
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) };
|
||||||
|
|
||||||
Assert.False(response == null, "Response object is null because the client could not " +
|
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
||||||
"connect to the server after multiple retries");
|
var response = await RetryHelper.RetryRequest(async () =>
|
||||||
|
{
|
||||||
|
return await httpClient.GetAsync(string.Empty);
|
||||||
|
}, logger: logger, cancellationToken: deploymentResult.HostShutdownToken);
|
||||||
|
|
||||||
var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult);
|
Assert.False(response == null, "Response object is null because the client could not " +
|
||||||
|
"connect to the server after multiple retries");
|
||||||
|
|
||||||
Console.WriteLine("Verifying home page");
|
var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult);
|
||||||
await validator.VerifyNtlmHomePage(response);
|
|
||||||
|
|
||||||
Console.WriteLine("Verifying access to store with permissions");
|
Console.WriteLine("Verifying home page");
|
||||||
await validator.AccessStoreWithPermissions();
|
await validator.VerifyNtlmHomePage(response);
|
||||||
|
|
||||||
_logger.LogInformation("Variation completed successfully.");
|
Console.WriteLine("Verifying access to store with permissions");
|
||||||
|
await validator.AccessStoreWithPermissions();
|
||||||
|
|
||||||
|
logger.LogInformation("Variation completed successfully.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Console.WriteLine("Finished NtlmAuthenticationTest");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -12,114 +12,121 @@ using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace E2ETests
|
namespace E2ETests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5040 - 5049.
|
|
||||||
public class OpenIdConnectTests : IDisposable
|
public class OpenIdConnectTests : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public OpenIdConnectTests(ITestOutputHelper output)
|
public OpenIdConnectTests(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5040/")]
|
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5041/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5042/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
public async Task OpenIdConnect_OnWindowsOS(
|
public async Task OpenIdConnect_OnWindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5043/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5044/", Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
||||||
public async Task OpenIdConnect_OnNonWindows(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl)
|
public async Task OpenIdConnect_OnNonWindows(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: temporarily disabling x86 tests as dotnet xunit test runner currently does not support 32-bit
|
// TODO: temporarily disabling x86 tests as dotnet xunit test runner currently does not support 32-bit
|
||||||
|
|
||||||
//[ConditionalTheory(Skip = "https://github.com/aspnet/MusicStore/issues/565"), Trait("E2Etests", "E2Etests")]
|
//[ConditionalTheory(Skip = "https://github.com/aspnet/MusicStore/issues/565"), Trait("E2Etests", "E2Etests")]
|
||||||
//[OSSkipCondition(OperatingSystems.Windows)]
|
//[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5045/")]
|
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
//public async Task OpenIdConnect_OnMono(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl)
|
//public async Task OpenIdConnect_OnMono(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
//{
|
//{
|
||||||
// await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
// await OpenIdConnectTestSuite(serverType, runtimeFlavor, architecture);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType, string applicationBaseUrl)
|
private async Task OpenIdConnectTestSuite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
using (_logger.BeginScope("OpenIdConnectTestSuite"))
|
try
|
||||||
{
|
{
|
||||||
var musicStoreDbName = DbUtils.GetUniqueName();
|
Console.WriteLine($"Starting OpenIdConnectTestSuite:{serverType}:{runtimeFlavor}:{architecture}:{applicationType}");
|
||||||
|
var logger = _loggerFactory.CreateLogger($"OpenIdConnectTestSuite:{serverType}:{runtimeFlavor}:{architecture}:{applicationType}");
|
||||||
var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
using (logger.BeginScope("OpenIdConnectTestSuite"))
|
||||||
{
|
{
|
||||||
PublishApplicationBeforeDeployment = true,
|
var musicStoreDbName = DbUtils.GetUniqueName();
|
||||||
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
|
||||||
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
||||||
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
|
||||||
ApplicationType = applicationType,
|
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
|
||||||
EnvironmentName = "OpenIdConnectTesting",
|
|
||||||
UserAdditionalCleanup = parameters =>
|
|
||||||
{
|
{
|
||||||
DbUtils.DropDatabase(musicStoreDbName, _logger);
|
PublishApplicationBeforeDeployment = true,
|
||||||
|
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
||||||
|
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
||||||
|
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
||||||
|
ApplicationType = applicationType,
|
||||||
|
EnvironmentName = "OpenIdConnectTesting",
|
||||||
|
UserAdditionalCleanup = parameters =>
|
||||||
|
{
|
||||||
|
DbUtils.DropDatabase(musicStoreDbName, logger);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (applicationType == ApplicationType.Standalone)
|
||||||
|
{
|
||||||
|
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (applicationType == ApplicationType.Standalone)
|
// Override the connection strings using environment based configuration
|
||||||
{
|
deploymentParameters.EnvironmentVariables
|
||||||
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
.Add(new KeyValuePair<string, string>(
|
||||||
}
|
MusicStoreConfig.ConnectionStringKey,
|
||||||
|
DbUtils.CreateConnectionString(musicStoreDbName)));
|
||||||
|
|
||||||
// Override the connection strings using environment based configuration
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory))
|
||||||
deploymentParameters.EnvironmentVariables
|
|
||||||
.Add(new KeyValuePair<string, string>(
|
|
||||||
MusicStoreConfig.ConnectionStringKey,
|
|
||||||
DbUtils.CreateConnectionString(musicStoreDbName)));
|
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger))
|
|
||||||
{
|
|
||||||
var deploymentResult = deployer.Deploy();
|
|
||||||
var httpClientHandler = new HttpClientHandler();
|
|
||||||
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) };
|
|
||||||
|
|
||||||
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
|
||||||
var response = await RetryHelper.RetryRequest(async () =>
|
|
||||||
{
|
{
|
||||||
return await httpClient.GetAsync(string.Empty);
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
}, logger: _logger, cancellationToken: deploymentResult.HostShutdownToken);
|
var httpClientHandler = new HttpClientHandler();
|
||||||
|
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) };
|
||||||
|
|
||||||
Assert.False(response == null, "Response object is null because the client could not " +
|
// Request to base address and check if various parts of the body are rendered & measure the cold startup time.
|
||||||
"connect to the server after multiple retries");
|
var response = await RetryHelper.RetryRequest(async () =>
|
||||||
|
{
|
||||||
|
return await httpClient.GetAsync(string.Empty);
|
||||||
|
}, logger: logger, cancellationToken: deploymentResult.HostShutdownToken);
|
||||||
|
|
||||||
var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult);
|
Assert.False(response == null, "Response object is null because the client could not " +
|
||||||
|
"connect to the server after multiple retries");
|
||||||
|
|
||||||
Console.WriteLine("Verifying home page");
|
var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult);
|
||||||
await validator.VerifyHomePage(response);
|
|
||||||
|
|
||||||
Console.WriteLine("Verifying login by OpenIdConnect");
|
Console.WriteLine("Verifying home page");
|
||||||
await validator.LoginWithOpenIdConnect();
|
await validator.VerifyHomePage(response);
|
||||||
|
|
||||||
_logger.LogInformation("Variation completed successfully.");
|
Console.WriteLine("Verifying login by OpenIdConnect");
|
||||||
|
await validator.LoginWithOpenIdConnect();
|
||||||
|
|
||||||
|
logger.LogInformation("Variation completed successfully.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Console.WriteLine("Finished OpenIdConnectTestSuite");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using E2ETests.Common;
|
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.DotNet.PlatformAbstractions;
|
using Microsoft.DotNet.PlatformAbstractions;
|
||||||
|
|
@ -13,58 +12,56 @@ using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace E2ETests
|
namespace E2ETests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5025 - 5039.
|
|
||||||
public class PublishAndRunTests_OnX64 : IDisposable
|
public class PublishAndRunTests_OnX64 : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public PublishAndRunTests_OnX64(ITestOutputHelper output)
|
public PublishAndRunTests_OnX64(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5025/", false)]
|
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5026/", false)]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5027/", false)]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, false)]
|
||||||
// [InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5028/", false)]
|
// [InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5029/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5030/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, false)]
|
||||||
public async Task WindowsOS(
|
public async Task WindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource)
|
bool noSource)
|
||||||
{
|
{
|
||||||
var testRunner = new PublishAndRunTests(_logger);
|
var testRunner = new PublishAndRunTests(_loggerFactory);
|
||||||
await testRunner.Publish_And_Run_Tests(
|
await testRunner.Publish_And_Run_Tests(
|
||||||
serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl, noSource);
|
serverType, runtimeFlavor, architecture, applicationType, noSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5031/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5032/", false, Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, false, Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
||||||
public async Task NonWindowsOS(
|
public async Task NonWindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource)
|
bool noSource)
|
||||||
{
|
{
|
||||||
var testRunner = new PublishAndRunTests(_logger);
|
var testRunner = new PublishAndRunTests(_loggerFactory);
|
||||||
await testRunner.Publish_And_Run_Tests(
|
await testRunner.Publish_And_Run_Tests(
|
||||||
serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl, noSource);
|
serverType, runtimeFlavor, architecture, applicationType, noSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,64 +69,63 @@ namespace E2ETests
|
||||||
// public
|
// public
|
||||||
class PublishAndRunTests_OnX86 : IDisposable
|
class PublishAndRunTests_OnX86 : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public PublishAndRunTests_OnX86(ITestOutputHelper output)
|
public PublishAndRunTests_OnX86(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5034/", false)]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5035/", false)]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, "http://localhost:5036/", false)]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5037/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5038/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, false)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, "http://localhost:5039/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, false)]
|
||||||
public async Task WindowsOS(
|
public async Task WindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource)
|
bool noSource)
|
||||||
{
|
{
|
||||||
var testRunner = new PublishAndRunTests(_logger);
|
var testRunner = new PublishAndRunTests(_loggerFactory);
|
||||||
await testRunner.Publish_And_Run_Tests(
|
await testRunner.Publish_And_Run_Tests(
|
||||||
serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl, noSource);
|
serverType, runtimeFlavor, architecture, applicationType, noSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
[ConditionalTheory, Trait("E2Etests", "PublishAndRun")]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5040/", false)]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, false)]
|
||||||
public async Task NonWindowsOS(
|
public async Task NonWindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource)
|
bool noSource)
|
||||||
{
|
{
|
||||||
var testRunner = new PublishAndRunTests(_logger);
|
var testRunner = new PublishAndRunTests(_loggerFactory);
|
||||||
await testRunner.Publish_And_Run_Tests(
|
await testRunner.Publish_And_Run_Tests(
|
||||||
serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl, noSource);
|
serverType, runtimeFlavor, architecture, applicationType, noSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PublishAndRunTests
|
public class PublishAndRunTests
|
||||||
{
|
{
|
||||||
private ILogger _logger;
|
private ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public PublishAndRunTests(ILogger logger)
|
public PublishAndRunTests(ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_loggerFactory = loggerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Publish_And_Run_Tests(
|
public async Task Publish_And_Run_Tests(
|
||||||
|
|
@ -137,74 +133,82 @@ namespace E2ETests
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource)
|
bool noSource)
|
||||||
{
|
{
|
||||||
using (_logger.BeginScope("Publish_And_Run_Tests"))
|
var testName = $"PublishAndRunTests:{serverType}:{runtimeFlavor}:{architecture}:{applicationType}:NoSource={noSource}";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var musicStoreDbName = DbUtils.GetUniqueName();
|
Console.WriteLine($"Starting {testName}");
|
||||||
|
var logger = _loggerFactory.CreateLogger(testName);
|
||||||
var deploymentParameters = new DeploymentParameters(
|
using (logger.BeginScope("Publish_And_Run_Tests"))
|
||||||
Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
|
||||||
{
|
{
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
var musicStoreDbName = DbUtils.GetUniqueName();
|
||||||
PublishApplicationBeforeDeployment = true,
|
|
||||||
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
var deploymentParameters = new DeploymentParameters(
|
||||||
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
||||||
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
|
||||||
ApplicationType = applicationType,
|
|
||||||
UserAdditionalCleanup = parameters =>
|
|
||||||
{
|
{
|
||||||
DbUtils.DropDatabase(musicStoreDbName, _logger);
|
PublishApplicationBeforeDeployment = true,
|
||||||
}
|
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
||||||
};
|
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.1",
|
||||||
|
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
||||||
if (applicationType == ApplicationType.Standalone)
|
ApplicationType = applicationType,
|
||||||
{
|
UserAdditionalCleanup = parameters =>
|
||||||
deploymentParameters.AdditionalPublishParameters = "-r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override the connection strings using environment based configuration
|
|
||||||
deploymentParameters.EnvironmentVariables
|
|
||||||
.Add(new KeyValuePair<string, string>(
|
|
||||||
MusicStoreConfig.ConnectionStringKey,
|
|
||||||
DbUtils.CreateConnectionString(musicStoreDbName)));
|
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger))
|
|
||||||
{
|
|
||||||
var deploymentResult = deployer.Deploy();
|
|
||||||
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
|
|
||||||
var httpClient = new HttpClient(httpClientHandler);
|
|
||||||
httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri);
|
|
||||||
|
|
||||||
// Request to base address and check if various parts of the body are rendered &
|
|
||||||
// measure the cold startup time.
|
|
||||||
// Add retry logic since tests are flaky on mono due to connection issues
|
|
||||||
var response = await RetryHelper.RetryRequest(async () => await httpClient.GetAsync(string.Empty), logger: _logger, cancellationToken: deploymentResult.HostShutdownToken);
|
|
||||||
|
|
||||||
Assert.False(response == null, "Response object is null because the client could not " +
|
|
||||||
"connect to the server after multiple retries");
|
|
||||||
|
|
||||||
var validator = new Validator(httpClient, httpClientHandler, _logger, deploymentResult);
|
|
||||||
|
|
||||||
Console.WriteLine("Verifying home page");
|
|
||||||
await validator.VerifyHomePage(response);
|
|
||||||
|
|
||||||
Console.WriteLine("Verifying static files are served from static file middleware");
|
|
||||||
await validator.VerifyStaticContentServed();
|
|
||||||
|
|
||||||
if (serverType != ServerType.IISExpress)
|
|
||||||
{
|
|
||||||
if (Directory.GetFiles(
|
|
||||||
deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0)
|
|
||||||
{
|
{
|
||||||
throw new Exception("publishExclude parameter values are not honored.");
|
DbUtils.DropDatabase(musicStoreDbName, logger);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (applicationType == ApplicationType.Standalone)
|
||||||
|
{
|
||||||
|
deploymentParameters.AdditionalPublishParameters = "-r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Variation completed successfully.");
|
// Override the connection strings using environment based configuration
|
||||||
|
deploymentParameters.EnvironmentVariables
|
||||||
|
.Add(new KeyValuePair<string, string>(
|
||||||
|
MusicStoreConfig.ConnectionStringKey,
|
||||||
|
DbUtils.CreateConnectionString(musicStoreDbName)));
|
||||||
|
|
||||||
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory))
|
||||||
|
{
|
||||||
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true };
|
||||||
|
var httpClient = new HttpClient(httpClientHandler);
|
||||||
|
httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri);
|
||||||
|
|
||||||
|
// Request to base address and check if various parts of the body are rendered &
|
||||||
|
// measure the cold startup time.
|
||||||
|
// Add retry logic since tests are flaky on mono due to connection issues
|
||||||
|
var response = await RetryHelper.RetryRequest(async () => await httpClient.GetAsync(string.Empty), logger: logger, cancellationToken: deploymentResult.HostShutdownToken);
|
||||||
|
|
||||||
|
Assert.False(response == null, "Response object is null because the client could not " +
|
||||||
|
"connect to the server after multiple retries");
|
||||||
|
|
||||||
|
var validator = new Validator(httpClient, httpClientHandler, logger, deploymentResult);
|
||||||
|
|
||||||
|
Console.WriteLine("Verifying home page");
|
||||||
|
await validator.VerifyHomePage(response);
|
||||||
|
|
||||||
|
Console.WriteLine("Verifying static files are served from static file middleware");
|
||||||
|
await validator.VerifyStaticContentServed();
|
||||||
|
|
||||||
|
if (serverType != ServerType.IISExpress)
|
||||||
|
{
|
||||||
|
if (Directory.GetFiles(
|
||||||
|
deploymentParameters.ApplicationPath, "*.cmd", SearchOption.TopDirectoryOnly).Length > 0)
|
||||||
|
{
|
||||||
|
throw new Exception("publishExclude parameter values are not honored.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.LogInformation("Variation completed successfully.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Finished {testName}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using E2ETests.Common;
|
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.DotNet.PlatformAbstractions;
|
using Microsoft.DotNet.PlatformAbstractions;
|
||||||
|
|
@ -14,118 +13,116 @@ namespace E2ETests
|
||||||
{
|
{
|
||||||
// Uses ports ranging 5001 - 5025.
|
// Uses ports ranging 5001 - 5025.
|
||||||
// TODO: temporarily disabling these tests as dotnet xunit runner does not support 32-bit yet.
|
// TODO: temporarily disabling these tests as dotnet xunit runner does not support 32-bit yet.
|
||||||
// public
|
internal class SmokeTests_X86 : IDisposable
|
||||||
class SmokeTests_X86 : IDisposable
|
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public SmokeTests_X86(ITestOutputHelper output)
|
public SmokeTests_X86(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5001/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5002/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, "http://localhost:5003/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5004/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5005/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, "http://localhost:5006/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5007/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5008/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone, "http://localhost:5009/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||||
public async Task WindowsOS(
|
public async Task WindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
var smokeTestRunner = new SmokeTests(_logger);
|
var smokeTestRunner = new SmokeTests(_loggerFactory);
|
||||||
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory(Skip = "Temporarily disabling test"), Trait("E2Etests", "Smoke")]
|
[ConditionalTheory(Skip = "Temporarily disabling test"), Trait("E2Etests", "Smoke")]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5010/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
public async Task NonWindowsOS(
|
public async Task NonWindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
var smokeTestRunner = new SmokeTests(_logger);
|
var smokeTestRunner = new SmokeTests(_loggerFactory);
|
||||||
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SmokeTests_X64 : IDisposable
|
public class SmokeTests_X64 : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public SmokeTests_X64(ITestOutputHelper output)
|
public SmokeTests_X64(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5011/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5012/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5013/")]
|
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5014/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5015/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5016/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5017/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5018/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5019/")]
|
[InlineData(ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
public async Task WindowsOS(
|
public async Task WindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
var smokeTestRunner = new SmokeTests(_logger);
|
var smokeTestRunner = new SmokeTests(_loggerFactory);
|
||||||
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
||||||
[OSSkipCondition(OperatingSystems.Windows)]
|
[OSSkipCondition(OperatingSystems.Windows)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5020/")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5021/", Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, Skip = "https://github.com/aspnet/MusicStore/issues/761")]
|
||||||
public async Task NonWindowsOS(
|
public async Task NonWindowsOS(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
var smokeTestRunner = new SmokeTests(_logger);
|
var smokeTestRunner = new SmokeTests(_loggerFactory);
|
||||||
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl);
|
await smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationType);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SmokeTests_OnIIS : IDisposable
|
class SmokeTests_OnIIS : IDisposable
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public SmokeTests_OnIIS(ITestOutputHelper output)
|
public SmokeTests_OnIIS(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
[ConditionalTheory, Trait("E2Etests", "Smoke")]
|
||||||
|
|
@ -133,34 +130,33 @@ namespace E2ETests
|
||||||
[OSSkipCondition(OperatingSystems.Linux)]
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||||
[SkipIfEnvironmentVariableNotEnabled("IIS_VARIATIONS_ENABLED")]
|
[SkipIfEnvironmentVariableNotEnabled("IIS_VARIATIONS_ENABLED")]
|
||||||
//[InlineData(ServerType.IIS, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable, "http://localhost:5022/")]
|
//[InlineData(ServerType.IIS, RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IIS, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable, "http://localhost:5023/")]
|
[InlineData(ServerType.IIS, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||||
[InlineData(ServerType.IIS, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone, "http://localhost:5024/")]
|
[InlineData(ServerType.IIS, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||||
public async Task SmokeTestSuite_On_IIS_X86(
|
public async Task SmokeTestSuite_On_IIS_X86(
|
||||||
ServerType serverType,
|
ServerType serverType,
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType)
|
||||||
string applicationBaseUrl)
|
|
||||||
{
|
{
|
||||||
var smokeTestRunner = new SmokeTests(_logger);
|
var smokeTestRunner = new SmokeTests(_loggerFactory);
|
||||||
await smokeTestRunner.SmokeTestSuite(
|
await smokeTestRunner.SmokeTestSuite(
|
||||||
serverType, runtimeFlavor, architecture, applicationType, applicationBaseUrl, noSource: true);
|
serverType, runtimeFlavor, architecture, applicationType, noSource: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SmokeTests
|
public class SmokeTests
|
||||||
{
|
{
|
||||||
private ILogger _logger;
|
private ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public SmokeTests(ILogger logger)
|
public SmokeTests(ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_loggerFactory = loggerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SmokeTestSuite(
|
public async Task SmokeTestSuite(
|
||||||
|
|
@ -168,51 +164,59 @@ namespace E2ETests
|
||||||
RuntimeFlavor runtimeFlavor,
|
RuntimeFlavor runtimeFlavor,
|
||||||
RuntimeArchitecture architecture,
|
RuntimeArchitecture architecture,
|
||||||
ApplicationType applicationType,
|
ApplicationType applicationType,
|
||||||
string applicationBaseUrl,
|
|
||||||
bool noSource = false)
|
bool noSource = false)
|
||||||
{
|
{
|
||||||
using (_logger.BeginScope("SmokeTestSuite"))
|
var testName = $"SmokeTestSuite:{serverType}:{runtimeFlavor}:{architecture}:{applicationType}";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var musicStoreDbName = DbUtils.GetUniqueName();
|
Console.WriteLine($"Starting {testName}");
|
||||||
|
var logger = _loggerFactory.CreateLogger(testName);
|
||||||
var deploymentParameters = new DeploymentParameters(
|
using (logger.BeginScope("SmokeTestSuite"))
|
||||||
Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
|
||||||
{
|
{
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
var musicStoreDbName = DbUtils.GetUniqueName();
|
||||||
EnvironmentName = "SocialTesting",
|
|
||||||
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
|
var deploymentParameters = new DeploymentParameters(
|
||||||
SiteName = "MusicStoreTestSite",
|
Helpers.GetApplicationPath(applicationType), serverType, runtimeFlavor, architecture)
|
||||||
PublishApplicationBeforeDeployment = true,
|
|
||||||
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
|
||||||
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net46" : "netcoreapp1.1",
|
|
||||||
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
|
||||||
ApplicationType = applicationType,
|
|
||||||
UserAdditionalCleanup = parameters =>
|
|
||||||
{
|
{
|
||||||
DbUtils.DropDatabase(musicStoreDbName, _logger);
|
EnvironmentName = "SocialTesting",
|
||||||
|
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null,
|
||||||
|
SiteName = "MusicStoreTestSite",
|
||||||
|
PublishApplicationBeforeDeployment = true,
|
||||||
|
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
|
||||||
|
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net46" : "netcoreapp1.1",
|
||||||
|
Configuration = Helpers.GetCurrentBuildConfiguration(),
|
||||||
|
ApplicationType = applicationType,
|
||||||
|
UserAdditionalCleanup = parameters =>
|
||||||
|
{
|
||||||
|
DbUtils.DropDatabase(musicStoreDbName, logger);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (applicationType == ApplicationType.Standalone)
|
||||||
|
{
|
||||||
|
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (applicationType == ApplicationType.Standalone)
|
// Override the connection strings using environment based configuration
|
||||||
{
|
deploymentParameters.EnvironmentVariables
|
||||||
deploymentParameters.AdditionalPublishParameters = " -r " + RuntimeEnvironment.GetRuntimeIdentifier();
|
.Add(new KeyValuePair<string, string>(
|
||||||
}
|
MusicStoreConfig.ConnectionStringKey,
|
||||||
|
DbUtils.CreateConnectionString(musicStoreDbName)));
|
||||||
// Override the connection strings using environment based configuration
|
|
||||||
deploymentParameters.EnvironmentVariables
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _loggerFactory))
|
||||||
.Add(new KeyValuePair<string, string>(
|
{
|
||||||
MusicStoreConfig.ConnectionStringKey,
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
DbUtils.CreateConnectionString(musicStoreDbName)));
|
|
||||||
|
Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger);
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, _logger))
|
|
||||||
{
|
await SmokeTestHelper.RunTestsAsync(deploymentResult, logger);
|
||||||
var deploymentResult = deployer.Deploy();
|
}
|
||||||
|
|
||||||
Helpers.SetInMemoryStoreForIIS(deploymentParameters, _logger);
|
|
||||||
|
|
||||||
await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Finished {testName}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using E2ETests.Common;
|
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
@ -18,14 +17,15 @@ namespace E2ETests
|
||||||
public class SmokeTestsOnNanoServerUsingStandaloneRuntime : IDisposable
|
public class SmokeTestsOnNanoServerUsingStandaloneRuntime : IDisposable
|
||||||
{
|
{
|
||||||
private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer;
|
private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer;
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
||||||
|
|
||||||
public SmokeTestsOnNanoServerUsingStandaloneRuntime(ITestOutputHelper output)
|
public SmokeTestsOnNanoServerUsingStandaloneRuntime(ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
_remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
_remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
||||||
_smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _logger);
|
_smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _loggerFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2ETests", "NanoServer")]
|
[ConditionalTheory, Trait("E2ETests", "NanoServer")]
|
||||||
|
|
@ -43,7 +43,7 @@ namespace E2ETests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,15 +56,16 @@ namespace E2ETests
|
||||||
{
|
{
|
||||||
private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer;
|
private readonly SmokeTestsOnNanoServer _smokeTestsOnNanoServer;
|
||||||
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
|
|
||||||
public SmokeTestsOnNanoServerUsingSharedRuntime(
|
public SmokeTestsOnNanoServerUsingSharedRuntime(
|
||||||
DotnetRuntimeSetupTestFixture dotnetRuntimeSetupTestFixture, ITestOutputHelper output)
|
DotnetRuntimeSetupTestFixture dotnetRuntimeSetupTestFixture, ITestOutputHelper output)
|
||||||
{
|
{
|
||||||
_logger = new XunitLogger(output, LogLevel.Information);
|
_loggerFactory = new LoggerFactory()
|
||||||
|
.AddXunit(output);
|
||||||
_remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
_remoteDeploymentConfig = RemoteDeploymentConfigHelper.GetConfiguration();
|
||||||
_remoteDeploymentConfig.DotnetRuntimePathOnShare = dotnetRuntimeSetupTestFixture.DotnetRuntimePathOnShare;
|
_remoteDeploymentConfig.DotnetRuntimePathOnShare = dotnetRuntimeSetupTestFixture.DotnetRuntimePathOnShare;
|
||||||
_smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _logger);
|
_smokeTestsOnNanoServer = new SmokeTestsOnNanoServer(output, _remoteDeploymentConfig, _loggerFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory, Trait("E2Etests", "NanoServer")]
|
[ConditionalTheory, Trait("E2Etests", "NanoServer")]
|
||||||
|
|
@ -82,7 +83,7 @@ namespace E2ETests
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_logger.Dispose();
|
_loggerFactory.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copies dotnet runtime to the target server's file share.
|
// Copies dotnet runtime to the target server's file share.
|
||||||
|
|
@ -234,12 +235,12 @@ namespace E2ETests
|
||||||
|
|
||||||
class SmokeTestsOnNanoServer
|
class SmokeTestsOnNanoServer
|
||||||
{
|
{
|
||||||
private readonly XunitLogger _logger;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
private readonly RemoteDeploymentConfig _remoteDeploymentConfig;
|
||||||
|
|
||||||
public SmokeTestsOnNanoServer(ITestOutputHelper output, RemoteDeploymentConfig config, XunitLogger logger)
|
public SmokeTestsOnNanoServer(ITestOutputHelper output, RemoteDeploymentConfig config, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_loggerFactory = loggerFactory;
|
||||||
_remoteDeploymentConfig = config;
|
_remoteDeploymentConfig = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,42 +249,52 @@ namespace E2ETests
|
||||||
string applicationBaseUrl,
|
string applicationBaseUrl,
|
||||||
ApplicationType applicationType)
|
ApplicationType applicationType)
|
||||||
{
|
{
|
||||||
using (_logger.BeginScope(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime)))
|
var testName = $"SmokeTestsOnNanoServer:{serverType}:{applicationType}";
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var deploymentParameters = new RemoteWindowsDeploymentParameters(
|
Console.WriteLine($"Started {testName}");
|
||||||
Helpers.GetApplicationPath(applicationType),
|
var logger = _loggerFactory.CreateLogger(testName);
|
||||||
_remoteDeploymentConfig.DotnetRuntimePathOnShare,
|
using (logger.BeginScope(nameof(SmokeTestsOnNanoServerUsingStandaloneRuntime)))
|
||||||
serverType,
|
|
||||||
RuntimeFlavor.CoreClr,
|
|
||||||
RuntimeArchitecture.x64,
|
|
||||||
_remoteDeploymentConfig.FileSharePath,
|
|
||||||
_remoteDeploymentConfig.ServerName,
|
|
||||||
_remoteDeploymentConfig.AccountName,
|
|
||||||
_remoteDeploymentConfig.AccountPassword)
|
|
||||||
{
|
{
|
||||||
TargetFramework = "netcoreapp1.1",
|
var deploymentParameters = new RemoteWindowsDeploymentParameters(
|
||||||
ApplicationBaseUriHint = applicationBaseUrl,
|
Helpers.GetApplicationPath(applicationType),
|
||||||
ApplicationType = applicationType
|
_remoteDeploymentConfig.DotnetRuntimePathOnShare,
|
||||||
};
|
serverType,
|
||||||
|
RuntimeFlavor.CoreClr,
|
||||||
|
RuntimeArchitecture.x64,
|
||||||
|
_remoteDeploymentConfig.FileSharePath,
|
||||||
|
_remoteDeploymentConfig.ServerName,
|
||||||
|
_remoteDeploymentConfig.AccountName,
|
||||||
|
_remoteDeploymentConfig.AccountPassword)
|
||||||
|
{
|
||||||
|
TargetFramework = "netcoreapp1.1",
|
||||||
|
ApplicationBaseUriHint = applicationBaseUrl,
|
||||||
|
ApplicationType = applicationType
|
||||||
|
};
|
||||||
|
|
||||||
if (applicationType == ApplicationType.Standalone)
|
if (applicationType == ApplicationType.Standalone)
|
||||||
{
|
{
|
||||||
// Unable to use the RuntimeEnvironment.GetRuntimeIdentifier API here as NanoServer which is
|
// Unable to use the RuntimeEnvironment.GetRuntimeIdentifier API here as NanoServer which is
|
||||||
// part of Windows Server 2016 has a RID of 'win10-x64' where as the CI servers currently
|
// part of Windows Server 2016 has a RID of 'win10-x64' where as the CI servers currently
|
||||||
// run on Windows Server 2012 or less, which have different RIDs.
|
// run on Windows Server 2012 or less, which have different RIDs.
|
||||||
deploymentParameters.AdditionalPublishParameters = "-r win10-x64";
|
deploymentParameters.AdditionalPublishParameters = "-r win10-x64";
|
||||||
}
|
}
|
||||||
|
|
||||||
deploymentParameters.EnvironmentVariables.Add(
|
deploymentParameters.EnvironmentVariables.Add(
|
||||||
new KeyValuePair<string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting"));
|
new KeyValuePair<string, string>("ASPNETCORE_ENVIRONMENT", "SocialTesting"));
|
||||||
|
|
||||||
using (var deployer = new RemoteWindowsDeployer(deploymentParameters, _logger))
|
using (var deployer = new RemoteWindowsDeployer(deploymentParameters, logger))
|
||||||
{
|
{
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
|
||||||
await SmokeTestHelper.RunTestsAsync(deploymentResult, _logger);
|
await SmokeTestHelper.RunTestsAsync(deploymentResult, logger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Finished {testName}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue