Modifying E2E tests to run on coreclr

This commit is contained in:
Kiran Challa 2015-12-11 10:01:53 -08:00
parent 8897b49e83
commit 5c2ef70cae
12 changed files with 116 additions and 47 deletions

View File

@ -11,7 +11,7 @@ addons:
- libunwind8 - libunwind8
- zlib1g - zlib1g
env: env:
- KOREBUILD_DNU_RESTORE_CORECLR=true - KOREBUILD_DNU_RESTORE_CORECLR=true KOREBUILD_TEST_DNXCORE=true
install: install:
- curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/libuv-1.4.2/ - curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/libuv-1.4.2/
- sh autogen.sh - sh autogen.sh

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.Logging;
namespace MusicStore
{
public class MyMiddleware
{
private RequestDelegate _next;
private readonly ILogger<MyMiddleware> _logger;
public MyMiddleware(RequestDelegate next, ILogger<MyMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task Invoke(HttpContext httpContext)
{
var requestBuilder = new StringBuilder();
requestBuilder.AppendFormat("Request:{0}{1}{2} ||", httpContext.Request.Method, httpContext.Request.Path, httpContext.Request.QueryString);
foreach (var header in httpContext.Request.Headers)
{
requestBuilder.Append(header.Key + ": " + header.Value + " || ");
}
_logger.LogWarning(requestBuilder.ToString());
await _next.Invoke(httpContext);
var responseBuilder = new StringBuilder();
responseBuilder.AppendFormat("Response:{0} {1} {2}{3} ||", httpContext.Response.StatusCode, httpContext.Request.Method, httpContext.Request.Path, httpContext.Request.QueryString);
foreach (var header in httpContext.Response.Headers)
{
responseBuilder.Append(header.Key + ": " + header.Value + " || ");
}
_logger.LogWarning(responseBuilder.ToString());
}
}
}

View File

@ -42,7 +42,7 @@ namespace E2ETests
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Facebook")); Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Facebook"));
//This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now.
_httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = true }; _httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false };
_httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) }; _httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) };
response = await _httpClient.GetAsync("Account/Login"); response = await _httpClient.GetAsync("Account/Login");
@ -56,9 +56,10 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLogin", content); response = await _httpClient.PostAsync("Account/ExternalLogin", content);
response = await _httpClient.GetAsync(response.Headers.Location);
//Post a message to the Facebook middleware //Post a message to the Facebook middleware
response = await _httpClient.GetAsync("signin-facebook?code=ValidCode&state=ValidStateData"); response = await _httpClient.GetAsync("signin-facebook?code=ValidCode&state=ValidStateData");
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
@ -78,6 +79,7 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content); response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content);
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();

View File

@ -43,7 +43,7 @@ namespace E2ETests
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Google")); Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Google"));
//This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now.
_httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = true }; _httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false };
_httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) }; _httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) };
response = await _httpClient.GetAsync("Account/Login"); response = await _httpClient.GetAsync("Account/Login");
@ -60,6 +60,7 @@ namespace E2ETests
//Post a message to the Google middleware //Post a message to the Google middleware
response = await _httpClient.GetAsync("signin-google?code=ValidCode&state=ValidStateData"); response = await _httpClient.GetAsync("signin-google?code=ValidCode&state=ValidStateData");
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
@ -79,6 +80,7 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content); response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content);
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();

View File

@ -43,7 +43,7 @@ namespace E2ETests
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Microsoft")); Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Correlation.Microsoft"));
//This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now.
_httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = true }; _httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false };
_httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) }; _httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) };
response = await _httpClient.GetAsync("Account/Login"); response = await _httpClient.GetAsync("Account/Login");
@ -57,9 +57,10 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLogin", content); response = await _httpClient.PostAsync("Account/ExternalLogin", content);
response = await _httpClient.GetAsync(response.Headers.Location);
//Post a message to the MicrosoftAccount middleware //Post a message to the MicrosoftAccount middleware
response = await _httpClient.GetAsync("signin-microsoft?code=ValidCode&state=ValidStateData"); response = await _httpClient.GetAsync("signin-microsoft?code=ValidCode&state=ValidStateData");
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
@ -78,6 +79,7 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content); response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content);
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();

View File

@ -41,7 +41,7 @@ namespace E2ETests
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri))["__TwitterState"]); Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri))["__TwitterState"]);
//This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now. //This is just to generate a correlation cookie. Previous step would generate this cookie, but we have reset the handler now.
_httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = true }; _httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false };
_httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) }; _httpClient = new HttpClient(_httpClientHandler) { BaseAddress = new Uri(_deploymentResult.ApplicationBaseUri) };
response = await _httpClient.GetAsync("Account/Login"); response = await _httpClient.GetAsync("Account/Login");
@ -55,9 +55,10 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLogin", content); response = await _httpClient.PostAsync("Account/ExternalLogin", content);
response = await _httpClient.GetAsync(response.Headers.Location);
//Post a message to the Facebook middleware //Post a message to the Facebook middleware
response = await _httpClient.GetAsync("signin-twitter?oauth_token=valid_oauth_token&oauth_verifier=valid_oauth_verifier"); response = await _httpClient.GetAsync("signin-twitter?oauth_token=valid_oauth_token&oauth_verifier=valid_oauth_verifier");
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
@ -78,6 +79,7 @@ namespace E2ETests
content = new FormUrlEncodedContent(formParameters.ToArray()); content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content); response = await _httpClient.PostAsync("Account/ExternalLoginConfirmation", content);
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();

View File

@ -140,7 +140,7 @@ namespace E2ETests
{ {
_logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous"); _logger.LogInformation("Trying to access StoreManager that needs ManageStore claim with the current user : {email}", email ?? "Anonymous");
var response = await _httpClient.GetAsync("Admin/StoreManager/"); var response = await _httpClient.GetAsync("Admin/StoreManager/");
await ThrowIfResponseStatusNotOk(response); response = await _httpClient.GetAsync(response.Headers.Location);
var responseContent = await response.Content.ReadAsStringAsync(); var responseContent = await response.Content.ReadAsStringAsync();
ValidateLayoutPage(responseContent); ValidateLayoutPage(responseContent);
@ -254,6 +254,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/LogOff", content); response = await _httpClient.PostAsync("Account/LogOff", content);
response = await _httpClient.GetAsync(response.Headers.Location);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
if (!Helpers.RunningOnMono) if (!Helpers.RunningOnMono)
@ -312,6 +313,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Account/Login", content); response = await _httpClient.PostAsync("Account/Login", content);
response = await _httpClient.GetAsync(response.Headers.Location);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains(string.Format("Hello {0}!", email), responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains(string.Format("Hello {0}!", email), responseContent, StringComparison.OrdinalIgnoreCase);
Assert.Contains("Log off", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("Log off", responseContent, StringComparison.OrdinalIgnoreCase);
@ -335,6 +337,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Manage/ChangePassword", content); response = await _httpClient.PostAsync("Manage/ChangePassword", content);
response = await _httpClient.GetAsync(response.Headers.Location);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains("Your password has been changed.", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("Your password has been changed.", responseContent, StringComparison.OrdinalIgnoreCase);
Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application")); Assert.NotNull(_httpClientHandler.CookieContainer.GetCookies(new Uri(_deploymentResult.ApplicationBaseUri)).GetCookieWithName(".AspNet.Microsoft.AspNet.Identity.Application"));
@ -360,6 +363,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Admin/StoreManager/create", content); response = await _httpClient.PostAsync("Admin/StoreManager/create", content);
response = await _httpClient.GetAsync(response.Headers.Location);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
Assert.Equal<string>(_deploymentResult.ApplicationBaseUri + "Admin/StoreManager", response.RequestMessage.RequestUri.AbsoluteUri); Assert.Equal<string>(_deploymentResult.ApplicationBaseUri + "Admin/StoreManager", response.RequestMessage.RequestUri.AbsoluteUri);
Assert.Contains(albumName, responseContent); Assert.Contains(albumName, responseContent);
@ -405,6 +409,7 @@ namespace E2ETests
{ {
_logger.LogInformation("Getting details of a non-existing album with Id '-1'"); _logger.LogInformation("Getting details of a non-existing album with Id '-1'");
var response = await _httpClient.GetAsync("Admin/StoreManager/Details?id=-1"); var response = await _httpClient.GetAsync("Admin/StoreManager/Details?id=-1");
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
var responseContent = await response.Content.ReadAsStringAsync(); var responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains("Item not found.", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("Item not found.", responseContent, StringComparison.OrdinalIgnoreCase);
@ -425,6 +430,7 @@ namespace E2ETests
{ {
_logger.LogInformation("Adding album id '{albumId}' to the cart", albumId); _logger.LogInformation("Adding album id '{albumId}' to the cart", albumId);
var response = await _httpClient.GetAsync(string.Format("ShoppingCart/AddToCart?id={0}", albumId)); var response = await _httpClient.GetAsync(string.Format("ShoppingCart/AddToCart?id={0}", albumId));
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
var responseContent = await response.Content.ReadAsStringAsync(); var responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains(albumName, responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains(albumName, responseContent, StringComparison.OrdinalIgnoreCase);
@ -456,6 +462,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
response = await _httpClient.PostAsync("Checkout/AddressAndPayment", content); response = await _httpClient.PostAsync("Checkout/AddressAndPayment", content);
response = await _httpClient.GetAsync(response.Headers.Location);
responseContent = await response.Content.ReadAsStringAsync(); responseContent = await response.Content.ReadAsStringAsync();
Assert.Contains("<h2>Checkout Complete</h2>", responseContent, StringComparison.OrdinalIgnoreCase); Assert.Contains("<h2>Checkout Complete</h2>", responseContent, StringComparison.OrdinalIgnoreCase);
Assert.StartsWith(_deploymentResult.ApplicationBaseUri + "Checkout/Complete/", response.RequestMessage.RequestUri.AbsoluteUri, StringComparison.OrdinalIgnoreCase); Assert.StartsWith(_deploymentResult.ApplicationBaseUri + "Checkout/Complete/", response.RequestMessage.RequestUri.AbsoluteUri, StringComparison.OrdinalIgnoreCase);
@ -472,6 +479,7 @@ namespace E2ETests
var content = new FormUrlEncodedContent(formParameters.ToArray()); var content = new FormUrlEncodedContent(formParameters.ToArray());
var response = await _httpClient.PostAsync("Admin/StoreManager/RemoveAlbum", content); var response = await _httpClient.PostAsync("Admin/StoreManager/RemoveAlbum", content);
response = await _httpClient.GetAsync(response.Headers.Location);
await ThrowIfResponseStatusNotOk(response); await ThrowIfResponseStatusNotOk(response);
_logger.LogInformation("Verifying if the album '{album}' is deleted from store", albumName); _logger.LogInformation("Verifying if the album '{album}' is deleted from store", albumName);

View File

@ -53,7 +53,7 @@ namespace E2ETests
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
{ {
var deploymentResult = deployer.Deploy(); var deploymentResult = deployer.Deploy();
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true, AllowAutoRedirect = false };
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; 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. // Request to base address and check if various parts of the body are rendered & measure the cold startup time.

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Server.Testing; using Microsoft.AspNet.Server.Testing;
using Microsoft.AspNet.Testing;
using Microsoft.AspNet.Testing.xunit; using Microsoft.AspNet.Testing.xunit;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Xunit; using Xunit;
@ -59,7 +60,8 @@ namespace E2ETests
EnvironmentName = "OpenIdConnectTesting", EnvironmentName = "OpenIdConnectTesting",
UserAdditionalCleanup = parameters => UserAdditionalCleanup = parameters =>
{ {
if (!Helpers.RunningOnMono) if (!Helpers.RunningOnMono
&& TestPlatformHelper.IsWindows)
{ {
// Mono uses InMemoryStore // Mono uses InMemoryStore
DbUtils.DropDatabase(musicStoreDbName, logger); DbUtils.DropDatabase(musicStoreDbName, logger);
@ -76,7 +78,7 @@ namespace E2ETests
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
{ {
var deploymentResult = deployer.Deploy(); var deploymentResult = deployer.Deploy();
var httpClientHandler = new HttpClientHandler(); var httpClientHandler = new HttpClientHandler() { AllowAutoRedirect = false };
var httpClient = new HttpClient(httpClientHandler) { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; 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. // Request to base address and check if various parts of the body are rendered & measure the cold startup time.

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Server.Testing; using Microsoft.AspNet.Server.Testing;
using Microsoft.AspNet.Testing;
using Microsoft.AspNet.Testing.xunit; using Microsoft.AspNet.Testing.xunit;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Xunit; using Xunit;
@ -16,10 +17,10 @@ namespace E2ETests
[ConditionalTheory, Trait("E2Etests", "E2Etests")] [ConditionalTheory, Trait("E2Etests", "E2Etests")]
[OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5025/", false)] //[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5025/", false)]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5026/", false)] //[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5026/", false)]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5027/", false)] [InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5027/", false)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5028/", false)] [InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5028/", false)]
public async Task WindowsOS( public async Task WindowsOS(
ServerType serverType, ServerType serverType,
RuntimeFlavor runtimeFlavor, RuntimeFlavor runtimeFlavor,
@ -32,7 +33,7 @@ namespace E2ETests
serverType, runtimeFlavor, architecture, applicationBaseUrl, noSource); serverType, runtimeFlavor, architecture, applicationBaseUrl, noSource);
} }
[ConditionalTheory(Skip = "Bug https://github.com/aspnet/dnx/issues/2958"), Trait("E2Etests", "E2Etests")] [ConditionalTheory, Trait("E2Etests", "E2Etests")]
[OSSkipCondition(OperatingSystems.Windows)] [OSSkipCondition(OperatingSystems.Windows)]
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5030/", false)] [InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5030/", false)]
public async Task NonWindowsOS( public async Task NonWindowsOS(
@ -53,10 +54,10 @@ namespace E2ETests
[ConditionalTheory, Trait("E2Etests", "E2Etests")] [ConditionalTheory, Trait("E2Etests", "E2Etests")]
[OSSkipCondition(OperatingSystems.Linux)] [OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)] [OSSkipCondition(OperatingSystems.MacOSX)]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5031/", false)] //[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5031/", false)]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5032/", false)] //[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5032/", false)]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5033/", false)] [InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5033/", false)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5034/", false)] [InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5034/", false)]
public async Task WindowsOS( public async Task WindowsOS(
ServerType serverType, ServerType serverType,
RuntimeFlavor runtimeFlavor, RuntimeFlavor runtimeFlavor,
@ -95,7 +96,7 @@ namespace E2ETests
bool noSource) bool noSource)
{ {
var logger = new LoggerFactory() var logger = new LoggerFactory()
.AddConsole(LogLevel.Warning) .AddConsole(LogLevel.Information)
.CreateLogger($"Publish:{serverType}:{runtimeFlavor}:{architecture}:{noSource}"); .CreateLogger($"Publish:{serverType}:{runtimeFlavor}:{architecture}:{noSource}");
using (logger.BeginScope("Publish_And_Run_Tests")) using (logger.BeginScope("Publish_And_Run_Tests"))
@ -111,7 +112,8 @@ namespace E2ETests
PublishWithNoSource = noSource, PublishWithNoSource = noSource,
UserAdditionalCleanup = parameters => UserAdditionalCleanup = parameters =>
{ {
if (!Helpers.RunningOnMono) if (!Helpers.RunningOnMono
&& TestPlatformHelper.IsWindows)
{ {
// Mono uses InMemoryStore // Mono uses InMemoryStore
DbUtils.DropDatabase(musicStoreDbName, logger); DbUtils.DropDatabase(musicStoreDbName, logger);
@ -128,7 +130,7 @@ namespace E2ETests
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
{ {
var deploymentResult = deployer.Deploy(); var deploymentResult = deployer.Deploy();
var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true }; var httpClientHandler = new HttpClientHandler() { UseDefaultCredentials = true, AllowAutoRedirect = false };
var httpClient = new HttpClient(httpClientHandler); var httpClient = new HttpClient(httpClientHandler);
httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri); httpClient.BaseAddress = new Uri(deploymentResult.ApplicationBaseUri);

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Server.Testing; using Microsoft.AspNet.Server.Testing;
using Microsoft.AspNet.Testing;
using Microsoft.AspNet.Testing.xunit; using Microsoft.AspNet.Testing.xunit;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Xunit; using Xunit;
@ -123,6 +124,7 @@ namespace E2ETests
UserAdditionalCleanup = parameters => UserAdditionalCleanup = parameters =>
{ {
if (!Helpers.RunningOnMono if (!Helpers.RunningOnMono
&& TestPlatformHelper.IsWindows
&& parameters.ServerType != ServerType.IIS) && parameters.ServerType != ServerType.IIS)
{ {
// Mono uses InMemoryStore // Mono uses InMemoryStore
@ -142,7 +144,11 @@ namespace E2ETests
var deploymentResult = deployer.Deploy(); var deploymentResult = deployer.Deploy();
Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger); Helpers.SetInMemoryStoreForIIS(deploymentParameters, logger);
var httpClientHandler = new HttpClientHandler(); var httpClientHandler = new HttpClientHandler()
{
// Temporary workaround for issue https://github.com/dotnet/corefx/issues/4960
AllowAutoRedirect = false
};
var httpClient = new HttpClient(httpClientHandler) var httpClient = new HttpClient(httpClientHandler)
{ {
BaseAddress = new Uri(deploymentResult.ApplicationBaseUri), BaseAddress = new Uri(deploymentResult.ApplicationBaseUri),

View File

@ -1,29 +1,29 @@
{ {
"compilationOptions": { "compilationOptions": {
"warningsAsErrors": true "warningsAsErrors": true
}, },
"compile": [ "compile": [
"../../shared/**/*.cs" "../../shared/**/*.cs"
], ],
"commands": { "commands": {
"test": "xunit.runner.aspnet" "test": "xunit.runner.aspnet"
}, },
"dependencies": { "dependencies": {
"Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*", "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-*",
"Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.Testing": "1.0.0-*", "Microsoft.AspNet.Server.Testing": "1.0.0-*",
"Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.AspNet.WebUtilities": "1.0.0-*",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Extensions.Logging.Console": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*" "xunit.runner.aspnet": "2.0.0-aspnet-*"
}, },
"frameworks": { "frameworks": {
"dnx451": { "dnxcore50": {
"frameworkAssemblies": { "dependencies": {
"System.Data": "", "System.Data.SqlClient": "4.0.0-*",
"System.Net.Http": "", "System.Net.Http": "4.0.1-*",
"System.Xml": "" "System.Xml.XmlDocument": "4.0.0-*"
} }
}
} }
}
} }