Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2019-10-10 22:13:00 +0300
committerGitHub <noreply@github.com>2019-10-10 22:13:00 +0300
commit49b4ece74b1401a70a626f8b9d211cbc382b238a (patch)
treed181076eaa1c4b1bcf0007ab71ccda4869b1a83a
parent0ddb4a5328c6de5b3761c0814117027c0f3a1f69 (diff)
Clean up some tests and move to new Azure endpoint (#41603) (#360)
* Test only fixes * Port PR #36018 from master branch This PR changes the Azure test endpoint to use Azure App Service instead of the classic Azure Cloud Service endpoint. The use of the classic Azure Cloud Service is no longer recommended since it is harder to maintain. Once all remaining branches are converted, we will shut down the corefx-net.cloudapp.net endpoint. This PR also includes some other test fixes and tests disabled due to active issues.
-rw-r--r--src/Common/tests/System/Net/Configuration.Http.cs2
-rw-r--r--src/Common/tests/System/Net/Configuration.Security.cs2
-rw-r--r--src/Common/tests/System/Net/Configuration.cs2
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs1
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs11
-rw-r--r--src/System.Net.Requests/tests/HttpWebRequestTest.cs36
-rw-r--r--src/System.Net.WebClient/tests/WebClientTest.cs18
-rw-r--r--src/System.Net.WebSockets.Client/tests/CloseTest.cs2
-rw-r--r--src/System.Net.WebSockets.Client/tests/ConnectTest.cs6
9 files changed, 47 insertions, 33 deletions
diff --git a/src/Common/tests/System/Net/Configuration.Http.cs b/src/Common/tests/System/Net/Configuration.Http.cs
index 81961a637e..f4763451be 100644
--- a/src/Common/tests/System/Net/Configuration.Http.cs
+++ b/src/Common/tests/System/Net/Configuration.Http.cs
@@ -8,7 +8,7 @@ namespace System.Net.Test.Common
{
public static partial class Http
{
- private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
+ private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
public static string Host => GetValue("COREFX_HTTPHOST", DefaultAzureServer);
diff --git a/src/Common/tests/System/Net/Configuration.Security.cs b/src/Common/tests/System/Net/Configuration.Security.cs
index b5a3e5ccea..8fd095077a 100644
--- a/src/Common/tests/System/Net/Configuration.Security.cs
+++ b/src/Common/tests/System/Net/Configuration.Security.cs
@@ -8,7 +8,7 @@ namespace System.Net.Test.Common
{
public static partial class Security
{
- private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
+ private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
public static string ActiveDirectoryName => GetValue("COREFX_NET_AD_DOMAINNAME");
diff --git a/src/Common/tests/System/Net/Configuration.cs b/src/Common/tests/System/Net/Configuration.cs
index 1aa664d2aa..5587d1fd28 100644
--- a/src/Common/tests/System/Net/Configuration.cs
+++ b/src/Common/tests/System/Net/Configuration.cs
@@ -7,7 +7,7 @@ namespace System.Net.Test.Common
public static partial class Configuration
{
#pragma warning disable 414
- private static readonly string DefaultAzureServer = "corefx-net.cloudapp.net";
+ private static readonly string DefaultAzureServer = "corefx-net-http11.azurewebsites.net";
#pragma warning restore 414
private static string GetValue(string envName, string defaultValue=null)
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs
index 980155da22..f3fc264e7f 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.ServerCertificates.cs
@@ -311,6 +311,7 @@ namespace System.Net.Http.Functional.Tests
}
}
+ [ActiveIssue(41108)]
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP doesn't allow revocation checking to be turned off")]
[OuterLoop] // TODO: Issue #11345
[ConditionalFact(nameof(ClientSupportsDHECipherSuites), nameof(BackendSupportsX509Chain))]
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
index cc1cfeb44a..032cfaa560 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
@@ -2701,17 +2701,16 @@ namespace System.Net.Http.Functional.Tests
[InlineData(HttpStatusCode.MethodNotAllowed, "")]
public async Task GetAsync_CallMethod_ExpectedStatusLine(HttpStatusCode statusCode, string reasonPhrase)
{
- using (HttpClient client = CreateHttpClient())
+ await LoopbackServer.CreateClientAndServerAsync(async uri =>
{
- using (HttpResponseMessage response = await client.GetAsync(Configuration.Http.StatusCodeUri(
- false,
- (int)statusCode,
- reasonPhrase)))
+ using (HttpClient client = CreateHttpClient())
+ using (HttpResponseMessage response = await client.GetAsync(uri))
{
Assert.Equal(statusCode, response.StatusCode);
Assert.Equal(reasonPhrase, response.ReasonPhrase);
}
- }
+ }, server => server.AcceptConnectionSendCustomResponseAndCloseAsync(
+ $"HTTP/1.1 {(int)statusCode} {reasonPhrase}\r\nContent-Length: 0\r\n\r\n"));
}
#endregion
diff --git a/src/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/System.Net.Requests/tests/HttpWebRequestTest.cs
index 3745049b94..de37415ffa 100644
--- a/src/System.Net.Requests/tests/HttpWebRequestTest.cs
+++ b/src/System.Net.Requests/tests/HttpWebRequestTest.cs
@@ -456,31 +456,35 @@ namespace System.Net.Tests
[InlineData(false)]
[InlineData(true)]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "dotnet/corefx #19225")]
- public void KeepAlive_CorrectConnectionHeaderSent(bool? keepAlive)
+ public async Task KeepAlive_CorrectConnectionHeaderSent(bool? keepAlive)
{
- HttpWebRequest request = WebRequest.CreateHttp(Test.Common.Configuration.Http.RemoteEchoServer);
-
- if (keepAlive.HasValue)
+ await LoopbackServer.CreateServerAsync(async (server, url) =>
{
- request.KeepAlive = keepAlive.Value;
- }
+ HttpWebRequest request = WebRequest.CreateHttp(url);
+ request.Proxy = null; // Don't use a proxy since it might interfere with the Connection: headers.
+ if (keepAlive.HasValue)
+ {
+ request.KeepAlive = keepAlive.Value;
+ }
- using (var response = (HttpWebResponse)request.GetResponse())
- using (var body = new StreamReader(response.GetResponseStream()))
- {
- string content = body.ReadToEnd();
+ Task<WebResponse> getResponseTask = request.GetResponseAsync();
+ Task<List<string>> serverTask = server.AcceptConnectionSendResponseAndCloseAsync();
+
+ await TaskTimeoutExtensions.WhenAllOrAnyFailed(new Task[] { getResponseTask, serverTask });
+
+ List<string> requestLines = await serverTask;
if (!keepAlive.HasValue || keepAlive.Value)
{
- // Validate that the request doesn't contain Connection: "close", but we can't validate
- // that it does contain Connection: "keep-alive", as that's optional as of HTTP 1.1.
- Assert.DoesNotContain("\"Connection\": \"close\"", content, StringComparison.OrdinalIgnoreCase);
+ // Validate that the request doesn't contain "Connection: close", but we can't validate
+ // that it does contain "Connection: Keep-Alive", as that's optional as of HTTP 1.1.
+ Assert.DoesNotContain("Connection: close", requestLines, StringComparer.OrdinalIgnoreCase);
}
else
{
- Assert.Contains("\"Connection\": \"close\"", content, StringComparison.OrdinalIgnoreCase);
- Assert.DoesNotContain("\"Keep-Alive\"", content, StringComparison.OrdinalIgnoreCase);
+ Assert.Contains("Connection: close", requestLines, StringComparer.OrdinalIgnoreCase);
+ Assert.DoesNotContain("Keep-Alive", requestLines, StringComparer.OrdinalIgnoreCase);
}
- }
+ });
}
[Theory, MemberData(nameof(EchoServers))]
diff --git a/src/System.Net.WebClient/tests/WebClientTest.cs b/src/System.Net.WebClient/tests/WebClientTest.cs
index 45d32915da..1d11427f40 100644
--- a/src/System.Net.WebClient/tests/WebClientTest.cs
+++ b/src/System.Net.WebClient/tests/WebClientTest.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
@@ -15,6 +16,8 @@ using Xunit;
namespace System.Net.Tests
{
+ using Configuration = System.Net.Test.Common.Configuration;
+
public class WebClientTest
{
[Fact]
@@ -393,21 +396,26 @@ namespace System.Net.Tests
await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer));
}
- [OuterLoop("Networking test talking to remote server: issue #11345")]
+ public static IEnumerable<object[]> RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult_MemberData()
+ {
+ yield return new object[] { $"http://{Configuration.Http.Host}", true };
+ yield return new object[] { Configuration.Http.Host, false };
+ }
+
+ [OuterLoop("Uses external servers")]
[Theory]
- [InlineData("http://localhost", true)]
- [InlineData("localhost", false)]
+ [MemberData(nameof(RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult_MemberData))]
public static async Task RequestHeaders_AddHostHeaderAndSendRequest_ExpectedResult(string hostHeaderValue, bool throwsWebException)
{
var wc = new WebClient();
wc.Headers["Host"] = hostHeaderValue;
if (throwsWebException)
{
- await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer));
+ await Assert.ThrowsAsync<WebException>(() => wc.DownloadStringTaskAsync(Configuration.Http.RemoteEchoServer));
}
else
{
- await wc.DownloadStringTaskAsync(System.Net.Test.Common.Configuration.Http.RemoteEchoServer);
+ await wc.DownloadStringTaskAsync(Configuration.Http.RemoteEchoServer);
}
}
diff --git a/src/System.Net.WebSockets.Client/tests/CloseTest.cs b/src/System.Net.WebSockets.Client/tests/CloseTest.cs
index 732bd97607..5bb9f323a7 100644
--- a/src/System.Net.WebSockets.Client/tests/CloseTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/CloseTest.cs
@@ -17,6 +17,7 @@ namespace System.Net.WebSockets.Client.Tests
{
public CloseTest(ITestOutputHelper output) : base(output) { }
+ [ActiveIssue(36016)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseAsync_ServerInitiatedClose_Success(Uri server)
@@ -194,6 +195,7 @@ namespace System.Net.WebSockets.Client.Tests
}
}
+ [ActiveIssue(36016)]
[OuterLoop] // TODO: Issue #11345
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
public async Task CloseOutputAsync_ServerInitiated_CanSend(Uri server)
diff --git a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
index 8f75de2a23..1bfaabfd37 100644
--- a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
+++ b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs
@@ -92,9 +92,9 @@ namespace System.Net.WebSockets.Client.Tests
{
Uri server = System.Net.Test.Common.Configuration.WebSockets.RemoteEchoServer;
- // Send via the physical address such as "corefx-net.cloudapp.net"
- // Set the Host header to logical address like "subdomain.corefx-net.cloudapp.net"
- // Verify the scenario works and the remote server received "Host: subdomain.corefx-net.cloudapp.net"
+ // Send via the physical address such as "corefx-net-http11.azurewebsites.net"
+ // Set the Host header to logical address like "subdomain.corefx-net-http11.azurewebsites.net"
+ // Verify the scenario works and the remote server received "Host: subdomain.corefx-net-http11.azurewebsites.net"
string logicalHost = "subdomain." + server.Host;
using (var cws = new ClientWebSocket())