Skip to content

Commit

Permalink
Disable frequently failing tests (dotnet#101439)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm authored and Ruihan-Yin committed May 30, 2024
1 parent 4552b1d commit 227917a
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,15 @@ private string GetCookieValue(HttpRequestData request)
return cookieHeaderValue;
}

[Fact]
[ConditionalFact]
[SkipOnPlatform(TestPlatforms.Browser, "CookieContainer is not supported on Browser")]
public async Task GetAsync_SetCookieContainerAndCookieHeader_BothCookiesSent()
{
if (UseVersion == HttpVersion30)
{
throw new SkipTestException("https://github.com/dotnet/runtime/issues/101377");
}

await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand Down Expand Up @@ -313,7 +318,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url =>
using (HttpClient client = CreateHttpClient(handler))
{
client.DefaultRequestHeaders.ConnectionClose = true; // to avoid issues with connection pooling
await client.GetAsync(url1);
await client.GetAsync(url1);
}
},
async server =>
Expand Down
49 changes: 27 additions & 22 deletions src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ await LoopbackServer.CreateClientAndServerAsync(async proxyUri =>
public static IEnumerable<object[]> SecureAndNonSecure_IPBasedUri_MemberData() =>
from address in new[] { IPAddress.Loopback, IPAddress.IPv6Loopback }
from useSsl in BoolValues
// we could not create SslStream in browser, [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
// we could not create SslStream in browser, [ActiveIssue("https://github.com/dotnet/runtime/issues/37669", TestPlatforms.Browser)]
where PlatformDetection.IsNotBrowser || !useSsl
select new object[] { address, useSsl };

Expand Down Expand Up @@ -880,8 +880,8 @@ await LoopbackServer.CreateClientAndServerAsync(async url =>
"\r\n" +
"5\r\n" +
"hello" + // missing \r\n terminator
//"5\r\n" +
//"world" + // missing \r\n terminator
//"5\r\n" +
//"world" + // missing \r\n terminator
"0\r\n" +
"\r\n"));
}
Expand Down Expand Up @@ -985,7 +985,7 @@ await connection.WriteStringAsync(
});
}

[Theory]
[ConditionalTheory]
[InlineData(true, true, true)]
[InlineData(true, true, false)]
[InlineData(true, false, false)]
Expand All @@ -995,6 +995,11 @@ await connection.WriteStringAsync(
[ActiveIssue("https://github.com/dotnet/runtime/issues/65429", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))]
public async Task ReadAsStreamAsync_HandlerProducesWellBehavedResponseStream(bool? chunked, bool enableWasmStreaming, bool slowChunks)
{
if (UseVersion == HttpVersion30)
{
throw new SkipTestException("https://github.com/dotnet/runtime/issues/91757");
}

if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value)
{
return;
Expand Down Expand Up @@ -1094,7 +1099,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
if (PlatformDetection.IsBrowser)
{
#if !NETFRAMEWORK
if(slowChunks)
if (slowChunks)
{
Assert.Equal(1, await responseStream.ReadAsync(new Memory<byte>(buffer2)));
Assert.Equal((byte)'h', buffer2[0]);
Expand Down Expand Up @@ -1204,7 +1209,7 @@ await server.AcceptConnectionAsync(async connection =>
{
case true:
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Transfer-Encoding", "chunked") }, isFinal: false);
if(PlatformDetection.IsBrowser && slowChunks)
if (PlatformDetection.IsBrowser && slowChunks)
{
await connection.SendResponseBodyAsync("1\r\nh\r\n", false);
await tcs.Task;
Expand All @@ -1219,12 +1224,12 @@ await server.AcceptConnectionAsync(async connection =>
break;
case false:
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Content-Length", "11")}, content: "hello world");
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Content-Length", "11") }, content: "hello world");
break;
case null:
// This inject Content-Length header with null value to hint Loopback code to not include one automatically.
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Content-Length", null)}, isFinal: false);
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Content-Length", null) }, isFinal: false);
await connection.SendResponseBodyAsync("hello world");
break;
}
Expand Down Expand Up @@ -1459,10 +1464,10 @@ await LoopbackServerFactory.CreateServerAsync(async (server3, url3) =>
Task serverTask3 = server3.AcceptConnectionAsync(async connection3 =>
{
await connection3.ReadRequestDataAsync();
await connection3.SendResponseAsync(HttpStatusCode.OK, new HttpHeaderData[] { new HttpHeaderData("Content-Length", "20") }, isFinal : false);
await connection3.SendResponseBodyAsync("1234567890", isFinal : false);
await connection3.SendResponseAsync(HttpStatusCode.OK, new HttpHeaderData[] { new HttpHeaderData("Content-Length", "20") }, isFinal: false);
await connection3.SendResponseBodyAsync("1234567890", isFinal: false);
await unblockServers.Task;
await connection3.SendResponseBodyAsync("1234567890", isFinal : true);
await connection3.SendResponseBodyAsync("1234567890", isFinal: true);
});
// Make three requests
Expand Down Expand Up @@ -1536,7 +1541,7 @@ public async Task GetAsync_UnicodeHostName_SuccessStatusCodeInResponse()
}
}

#region Post Methods Tests
#region Post Methods Tests

[Fact]
[SkipOnPlatform(TestPlatforms.Browser, "ExpectContinue not supported on Browser")]
Expand Down Expand Up @@ -1580,13 +1585,13 @@ await server.AcceptConnectionAsync(async connection =>

public static IEnumerable<object[]> Interim1xxStatusCode()
{
yield return new object[] { (HttpStatusCode) 100 }; // 100 Continue.
yield return new object[] { (HttpStatusCode)100 }; // 100 Continue.
// 101 SwitchingProtocols will be treated as a final status code.
yield return new object[] { (HttpStatusCode) 102 }; // 102 Processing.
yield return new object[] { (HttpStatusCode) 103 }; // 103 EarlyHints.
yield return new object[] { (HttpStatusCode) 150 };
yield return new object[] { (HttpStatusCode) 180 };
yield return new object[] { (HttpStatusCode) 199 };
yield return new object[] { (HttpStatusCode)102 }; // 102 Processing.
yield return new object[] { (HttpStatusCode)103 }; // 103 EarlyHints.
yield return new object[] { (HttpStatusCode)150 };
yield return new object[] { (HttpStatusCode)180 };
yield return new object[] { (HttpStatusCode)199 };
}

[Theory]
Expand Down Expand Up @@ -1647,7 +1652,7 @@ await server.AcceptConnectionAsync(async connection =>
new HttpHeaderData("Content-type", "text/xml"),
new HttpHeaderData("Set-Cookie", SetCookieIgnored1)}, isFinal: false);
await connection.SendResponseAsync(responseStatusCode, headers: new HttpHeaderData[] {
await connection.SendResponseAsync(responseStatusCode, headers: new HttpHeaderData[] {
new HttpHeaderData("Cookie", "ignore_cookie=choco2"),
new HttpHeaderData("Content-type", "text/plain"),
new HttpHeaderData("Set-Cookie", SetCookieIgnored2)}, isFinal: false);
Expand Down Expand Up @@ -1751,7 +1756,7 @@ await server.AcceptConnectionAsync(async connection =>
{
await connection.ReadRequestDataAsync(readBody: false);
// Send multiple 100-Continue responses.
for (int count = 0 ; count < 4; count++)
for (int count = 0; count < 4; count++)
{
await connection.SendResponseAsync(HttpStatusCode.Continue, isFinal: false);
}
Expand Down Expand Up @@ -1855,7 +1860,7 @@ await server.AcceptConnectionAsync(async connection =>
{
await connection.ReadRequestDataAsync(readBody: false);
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] {new HttpHeaderData("Content-Length", $"{ResponseString.Length}")}, isFinal : false);
await connection.SendResponseAsync(HttpStatusCode.OK, headers: new HttpHeaderData[] { new HttpHeaderData("Content-Length", $"{ResponseString.Length}") }, isFinal: false);
byte[] body = await connection.ReadRequestBodyAsync();
Assert.Equal(RequestString, Encoding.ASCII.GetString(body));
Expand Down Expand Up @@ -2136,7 +2141,7 @@ await LoopbackServerFactory.CreateServerAsync(async (server, rootUrl) =>
}
});
}
#endregion
#endregion

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowserDomSupported))]
public async Task GetAsync_InvalidUrl_ExpectedExceptionThrown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.Net.Test.Common;
using System.Net.Quic;

using Microsoft.DotNet.XUnitExtensions;

namespace System.Net.Http.Functional.Tests
{
public abstract class HttpClientHandler_AltSvc_Test : HttpClientHandlerTestBase
Expand Down Expand Up @@ -71,9 +73,14 @@ public async Task AltSvc_Header_Upgrade_Success(Version fromVersion, bool overri
{ HttpVersion.Version20, false }
};

[Fact]
[ConditionalFact]
public async Task AltSvc_ConnectionFrame_UpgradeFrom20_Success()
{
if (UseVersion == HttpVersion30)
{
throw new SkipTestException("https://github.com/dotnet/runtime/issues/101376");
}

using Http2LoopbackServer firstServer = Http2LoopbackServer.CreateServer();
using Http3LoopbackServer secondServer = CreateHttp3LoopbackServer();
using HttpClient client = CreateHttpClient(HttpVersion.Version20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
using Xunit;
using Xunit.Abstractions;

using Microsoft.DotNet.XUnitExtensions;

namespace System.Net.Http.Functional.Tests
{
using Configuration = System.Net.Test.Common.Configuration;
Expand Down Expand Up @@ -283,12 +285,17 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
});
}

[Theory]
[ConditionalTheory]
[InlineData("Thu, 01 Dec 1994 16:00:00 GMT", true)]
[InlineData("-1", false)]
[InlineData("0", false)]
public async Task SendAsync_Expires_Success(string value, bool isValid)
{
if (UseVersion == HttpVersion30)
{
throw new SkipTestException("https://github.com/dotnet/runtime/issues/91757");
}

await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
{
using (HttpClient client = CreateHttpClient())
Expand Down

0 comments on commit 227917a

Please sign in to comment.