Add interop tests with headless chrome
This commit is contained in:
parent
a8073167e7
commit
31f1e170d0
|
|
@ -13,7 +13,7 @@
|
|||
*.png binary
|
||||
*.gif binary
|
||||
|
||||
*.cs text=auto diff=csharp
|
||||
*.cs text=auto diff=csharp
|
||||
*.vb text=auto
|
||||
*.resx text=auto
|
||||
*.c text=auto
|
||||
|
|
|
|||
|
|
@ -2,26 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2010
|
||||
MinimumVisualStudioVersion = 15.0.26730.03
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7972A5D6-3385-4127-9277-428506DD44FF}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.appveyor.yml = .appveyor.yml
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
.travis.yml = .travis.yml
|
||||
build.cmd = build.cmd
|
||||
build.ps1 = build.ps1
|
||||
build.sh = build.sh
|
||||
CONTRIBUTING.md = CONTRIBUTING.md
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Build.targets = Directory.Build.targets
|
||||
LICENSE.txt = LICENSE.txt
|
||||
NuGet.Config = NuGet.Config
|
||||
NuGetPackageVerifier.json = NuGetPackageVerifier.json
|
||||
README.md = README.md
|
||||
ToProjectReferences.ps1 = ToProjectReferences.ps1
|
||||
version.xml = version.xml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2D5D5227-4DBD-499A-96B1-76A36B03B750}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Directory.Build.props = src\Directory.Build.props
|
||||
|
|
@ -136,6 +116,28 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.Transport.Libuv.Bin
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kestrel.H2Spec.FunctionalTests", "test\Kestrel.H2Spec.FunctionalTests\Kestrel.H2Spec.FunctionalTests.csproj", "{C4123E55-5760-4557-B89B-39E1258FD7F9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{B19F67B8-7635-42C3-B5BF-00D1CC47FA64}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
build.cmd = build.cmd
|
||||
build.sh = build.sh
|
||||
CONTRIBUTING.md = CONTRIBUTING.md
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Build.targets = Directory.Build.targets
|
||||
korebuild-lock.txt = korebuild-lock.txt
|
||||
korebuild.json = korebuild.json
|
||||
LICENSE.txt = LICENSE.txt
|
||||
NuGet.config = NuGet.config
|
||||
NuGetPackageVerifier.json = NuGetPackageVerifier.json
|
||||
README.md = README.md
|
||||
run.cmd = run.cmd
|
||||
run.ps1 = run.ps1
|
||||
run.sh = run.sh
|
||||
ToProjectReferences.ps1 = ToProjectReferences.ps1
|
||||
version.props = version.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
|
|||
|
|
@ -5,33 +5,33 @@
|
|||
<!-- This files is typically managed by automation. Execute 'run.ps1 upgrade deps' to update these variables to the last-known-good versions. -->
|
||||
<PropertyGroup Label="Package Versions">
|
||||
<BenchmarkDotNetPackageVersion>0.10.13</BenchmarkDotNetPackageVersion>
|
||||
<InternalAspNetCoreAnalyzersPackageVersion>2.2.0-preview3-35457</InternalAspNetCoreAnalyzersPackageVersion>
|
||||
<InternalAspNetCoreAnalyzersPackageVersion>2.2.0-rtm-35536</InternalAspNetCoreAnalyzersPackageVersion>
|
||||
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview2-20181011.2</InternalAspNetCoreSdkPackageVersion>
|
||||
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
|
||||
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreAllPackageVersion>
|
||||
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreHostingPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreHttpPackageVersion>
|
||||
<MicrosoftAspNetCoreTestingPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-preview3-35457</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
|
||||
<MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationBinderPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsConfigurationBinderPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||
<MicrosoftExtensionsLoggingPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsLoggingPackageVersion>
|
||||
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||
<MicrosoftExtensionsOptionsPackageVersion>2.2.0-preview3-35457</MicrosoftExtensionsOptionsPackageVersion>
|
||||
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreAllPackageVersion>
|
||||
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreCertificatesGenerationSourcesPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHostingPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreHostingPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
|
||||
<MicrosoftAspNetCoreHttpPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreHttpPackageVersion>
|
||||
<MicrosoftAspNetCoreTestingPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-rtm-35536</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
|
||||
<MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationBinderPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsConfigurationBinderPackageVersion>
|
||||
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
|
||||
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsConfigurationJsonPackageVersion>
|
||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||
<MicrosoftExtensionsLoggingPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsLoggingPackageVersion>
|
||||
<MicrosoftExtensionsLoggingTestingPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsLoggingTestingPackageVersion>
|
||||
<MicrosoftExtensionsOptionsPackageVersion>2.2.0-rtm-35536</MicrosoftExtensionsOptionsPackageVersion>
|
||||
<MicrosoftInternalAspNetCoreH2SpecAllPackageVersion>2.1.1</MicrosoftInternalAspNetCoreH2SpecAllPackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview3-27008-03</MicrosoftNETCoreApp22PackageVersion>
|
||||
<MicrosoftNetHttpHeadersPackageVersion>2.2.0-preview3-35457</MicrosoftNetHttpHeadersPackageVersion>
|
||||
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview3-27014-02</MicrosoftNETCoreApp22PackageVersion>
|
||||
<MicrosoftNetHttpHeadersPackageVersion>2.2.0-rtm-35536</MicrosoftNetHttpHeadersPackageVersion>
|
||||
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
||||
<MoqPackageVersion>4.10.0</MoqPackageVersion>
|
||||
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.AspNetCore.Testing;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
|
@ -23,8 +24,6 @@ namespace H2Spec.FunctionalTests
|
|||
SkipReason = "Missing Windows ALPN support: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation#Support")]
|
||||
public class H2SpecTests : LoggedTest
|
||||
{
|
||||
private static readonly string _testCertPath = Path.Combine(Directory.GetCurrentDirectory(), "shared", "TestCertificates", "testCert.pfx");
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(H2SpecTestCases))]
|
||||
public async Task RunIndividualTestCase(H2SpecTestCase testCase)
|
||||
|
|
@ -37,7 +36,7 @@ namespace H2Spec.FunctionalTests
|
|||
listenOptions.Protocols = HttpProtocols.Http2;
|
||||
if (testCase.Https)
|
||||
{
|
||||
listenOptions.UseHttps(_testCertPath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\shared\TestResources.cs" LinkBase="shared" />
|
||||
<Content Include="..\shared\TestCertificates\*.pfx" LinkBase="shared\TestCertificates" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
public void UseHttpsDefaultsToDefaultCert()
|
||||
{
|
||||
var serverOptions = CreateServerOptions();
|
||||
var defaultCert = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
var defaultCert = TestResources.GetTestCertificate();
|
||||
serverOptions.DefaultCertificate = defaultCert;
|
||||
|
||||
serverOptions.ListenLocalhost(5000, options =>
|
||||
|
|
@ -65,7 +65,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
public void ConfigureHttpsDefaultsNeverLoadsDefaultCert()
|
||||
{
|
||||
var serverOptions = CreateServerOptions();
|
||||
var testCert = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
var testCert = TestResources.GetTestCertificate();
|
||||
serverOptions.ConfigureHttpsDefaults(options =>
|
||||
{
|
||||
Assert.Null(options.ServerCertificate);
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
public void ConfigureCertSelectorNeverLoadsDefaultCert()
|
||||
{
|
||||
var serverOptions = CreateServerOptions();
|
||||
var testCert = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
var testCert = TestResources.GetTestCertificate();
|
||||
serverOptions.ConfigureHttpsDefaults(options =>
|
||||
{
|
||||
Assert.Null(options.ServerCertificate);
|
||||
|
|
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -151,7 +151,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -238,7 +238,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -269,7 +269,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -295,7 +295,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
@ -323,7 +323,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
{
|
||||
listenOptions.UseHttps(o =>
|
||||
{
|
||||
o.ServerCertificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
o.ServerCertificate = new X509Certificate2(TestResources.GetTestCertificate());
|
||||
o.OnHandshakeStarted = () => handshakeStartedTcs.SetResult(null);
|
||||
|
||||
handshakeTimeout = o.HandshakeTimeout;
|
||||
|
|
@ -359,7 +359,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
new TestServiceContext(LoggerFactory),
|
||||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}))
|
||||
{
|
||||
using (var connection = server.CreateConnection())
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests
|
|||
listenOptions =>
|
||||
{
|
||||
listenOptions.UseConnectionLogging();
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
listenOptions.UseConnectionLogging();
|
||||
}))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests
|
|||
|
||||
serverOptions.ConfigureHttpsDefaults(opt =>
|
||||
{
|
||||
opt.ServerCertificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
opt.ServerCertificate = TestResources.GetTestCertificate();
|
||||
opt.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
|
||||
});
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests
|
|||
serverOptions.ConfigureEndpointDefaults(opt =>
|
||||
{
|
||||
opt.NoDelay = false;
|
||||
opt.UseHttps(new X509Certificate2(TestResources.TestCertificatePath, "testPassword"));
|
||||
opt.UseHttps(TestResources.GetTestCertificate());
|
||||
});
|
||||
|
||||
serverOptions.ConfigureHttpsDefaults(opt =>
|
||||
|
|
@ -335,7 +335,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests
|
|||
|
||||
serverOptions.ConfigureHttpsDefaults(opt =>
|
||||
{
|
||||
opt.ServerCertificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
opt.ServerCertificate = TestResources.GetTestCertificate();
|
||||
opt.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
|
||||
});
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Tests
|
|||
|
||||
serverOptions.ConfigureHttpsDefaults(opt =>
|
||||
{
|
||||
opt.ServerCertificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
opt.ServerCertificate = TestResources.GetTestCertificate();
|
||||
opt.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
if (testUrl.StartsWith("https"))
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
@ -461,7 +461,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
if (mockHttps)
|
||||
{
|
||||
options.DefaultCertificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
options.DefaultCertificate = TestResources.GetTestCertificate();
|
||||
}
|
||||
})
|
||||
.Configure(ConfigureEchoAddress);
|
||||
|
|
@ -545,7 +545,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
options.Listen(new IPEndPoint(IPAddress.Loopback, 0), listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
});
|
||||
})
|
||||
.UseUrls(useUrlsAddress)
|
||||
|
|
@ -622,7 +622,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
{
|
||||
options.Listen(new IPEndPoint(IPAddress.Loopback, 0), listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(TestResources.TestCertificatePath, "testPassword");
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
});
|
||||
})
|
||||
.PreferHostingUrls(true)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Interop.FunctionalTests
|
||||
{
|
||||
public static class ChromeConstants
|
||||
{
|
||||
public static string ExecutablePath { get; } = ResolveChromeExecutablePath();
|
||||
|
||||
private static string ResolveChromeExecutablePath()
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Google", "Chrome", "Application", "chrome.exe");
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
return Path.Combine("/usr", "bin", "chromium-browser");
|
||||
}
|
||||
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if NETCOREAPP2_2
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.FunctionalTests;
|
||||
using Microsoft.AspNetCore.Testing;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace Interop.FunctionalTests
|
||||
{
|
||||
[SkipIfChromeUnavailable]
|
||||
public class ChromeTests : LoggedTest
|
||||
{
|
||||
private static readonly string _postHtml =
|
||||
@"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type=""text/javascript"">
|
||||
function dosubmit() { document.forms[0].submit(); }
|
||||
</script>
|
||||
</head>
|
||||
<body onload=""dosubmit();"">
|
||||
<form action=""/"" method=""POST"" accept-charset=""utf-8"">
|
||||
</form>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
private string NetLogPath { get; set; }
|
||||
private string StartupLogPath { get; set; }
|
||||
private string ShutdownLogPath { get; set; }
|
||||
private string ChromeArgs { get; set; }
|
||||
|
||||
private void InitializeArgs()
|
||||
{
|
||||
NetLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.nl.json");
|
||||
StartupLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.su.json");
|
||||
ShutdownLogPath = Path.Combine(ResolvedLogOutputDirectory, $"{ResolvedTestMethodName}.sd.json");
|
||||
|
||||
ChromeArgs = $"--headless " +
|
||||
$"--disable-gpu " +
|
||||
$"--allow-insecure-localhost " +
|
||||
$"--enable-logging " +
|
||||
$"--dump-dom " +
|
||||
$"--virtual-time-budget=10000 " +
|
||||
$"--log-net-log={NetLogPath} " +
|
||||
$"--trace-startup --trace-startup-file={StartupLogPath} " +
|
||||
$"--trace-shutdown --trace-shutdown-file={ShutdownLogPath}";
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX, SkipReason = "Missing SslStream ALPN support: https://github.com/dotnet/corefx/issues/30492")]
|
||||
[MinimumOSVersion(OperatingSystems.Windows, WindowsVersions.Win81, SkipReason = "Missing Windows ALPN support: https://en.wikipedia.org/wiki/Application-Layer_Protocol_Negotiation#Support")]
|
||||
[InlineData("", "Interop HTTP/2 GET")]
|
||||
[InlineData("?TestMethod=POST", "Interop HTTP/2 POST")]
|
||||
public async Task Http2(string requestSuffix, string expectedResponse)
|
||||
{
|
||||
InitializeArgs();
|
||||
|
||||
using (var server = new TestServer(async context =>
|
||||
{
|
||||
if (string.Equals(context.Request.Query["TestMethod"], "POST", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
await context.Response.WriteAsync(_postHtml);
|
||||
}
|
||||
else
|
||||
{
|
||||
await context.Response.WriteAsync($"Interop {context.Request.Protocol} {context.Request.Method}");
|
||||
}
|
||||
},
|
||||
new TestServiceContext(LoggerFactory),
|
||||
options => options.Listen(IPAddress.Loopback, 0, listenOptions =>
|
||||
{
|
||||
listenOptions.Protocols = HttpProtocols.Http2;
|
||||
listenOptions.UseHttps(TestResources.GetTestCertificate());
|
||||
})))
|
||||
{
|
||||
var chromeOutput = await RunHeadlessChrome($"https://localhost:{server.Port}/{requestSuffix}");
|
||||
|
||||
AssertExpectedResponseOrShowDebugInstructions(expectedResponse, chromeOutput);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> RunHeadlessChrome(string testUrl)
|
||||
{
|
||||
var chromeArgs = $"{ChromeArgs} {testUrl}";
|
||||
var chromeStartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = ChromeConstants.ExecutablePath,
|
||||
Arguments = chromeArgs,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardOutput = true
|
||||
};
|
||||
|
||||
Logger.LogInformation($"Staring chrome: {ChromeConstants.ExecutablePath} {chromeArgs}");
|
||||
|
||||
var headlessChromeProcess = Process.Start(chromeStartInfo);
|
||||
var chromeOutput = await headlessChromeProcess.StandardOutput.ReadToEndAsync();
|
||||
|
||||
headlessChromeProcess.WaitForExit();
|
||||
|
||||
return chromeOutput;
|
||||
}
|
||||
|
||||
private void AssertExpectedResponseOrShowDebugInstructions(string expectedResponse, string actualResponse)
|
||||
{
|
||||
try
|
||||
{
|
||||
Assert.Contains(expectedResponse, actualResponse);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.LogError("Chrome interop tests failed. Please consult the following logs:");
|
||||
Logger.LogError($"Network logs: {NetLogPath}");
|
||||
Logger.LogError($"Startup logs: {StartupLogPath}");
|
||||
Logger.LogError($"Shutdown logs: {ShutdownLogPath}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif NET461 // No ALPN support
|
||||
#else
|
||||
#error TFMs need updating
|
||||
#endif
|
||||
|
|
@ -560,7 +560,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
|
|||
const int chunks = 256 * 1024;
|
||||
var chunkData = new byte[chunkSize];
|
||||
|
||||
var certificate = new X509Certificate2(TestResources.TestCertificatePath, "testPassword");
|
||||
var certificate = TestResources.GetTestCertificate();
|
||||
|
||||
var responseRateTimeoutMessageLogged = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var connectionStopMessageLogged = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
|
||||
namespace Interop.FunctionalTests
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
|
||||
public class SkipIfChromeUnavailableAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet => string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JENKINS_HOME")) && (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("CI")) || File.Exists(ChromeConstants.ExecutablePath));
|
||||
|
||||
public string SkipReason => "This is running on Jenkins or Chrome/Chromium is not installed and this is a dev environment.";
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in New Issue