Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser][tests][outerloop] Standup OuterLoop ClientWebSocket tests #45470

Merged
merged 20 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e412aa9
[browser][tests][outerloop] Standup OuterLoop tests
kjpou1 Dec 2, 2020
e5629ff
Reference issue not PR
kjpou1 Dec 2, 2020
5acaa5e
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 3, 2020
bff9bec
Add active issue for CloseDescription failing tests
kjpou1 Dec 3, 2020
050cc08
Add active issue for failures for invalid close codes failing tests
kjpou1 Dec 3, 2020
2448238
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 4, 2020
5e54a1d
Add active issue for failures when specifying subprotocol by URI Query
kjpou1 Dec 4, 2020
4b1f4ef
Add active issue for Uncaught RuntimeError: memory access out of bounds
kjpou1 Dec 4, 2020
36f6abb
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 7, 2020
6ca3ee9
Remove ActiveIssue and initialize with specific platform detection code
kjpou1 Dec 7, 2020
9727e0f
Add ActiveIssue for CloseOutputAsync
kjpou1 Dec 7, 2020
e83c688
Add ActiveIssue for AbortTests
kjpou1 Dec 7, 2020
f5b20bf
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 8, 2020
fa2e118
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 9, 2020
6d64ad2
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 9, 2020
366b5cd
Remove ActiveIssue and initialize with specific platform detection code
kjpou1 Dec 9, 2020
f57b60e
Remove Active issue as it was fixed.
kjpou1 Dec 9, 2020
fa53bc3
Add ActiveIssue for CancelTests that is part of the Abort tests changes
kjpou1 Dec 9, 2020
cc1e330
Merge branch 'master' of https://github.com/dotnet/runtime into wasm-…
kjpou1 Dec 10, 2020
c7d62e8
Update src/libraries/System.Net.WebSockets.Client/tests/ClientWebSock…
lewing Dec 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/libraries/System.Net.WebSockets.Client/tests/AbortTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public AbortTest(ITestOutputHelper output) : base(output) { }

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task Abort_ConnectAndAbort_ThrowsWebSocketExceptionWithmessage(Uri server)
{
using (var cws = new ClientWebSocket())
Expand All @@ -42,6 +43,7 @@ public async Task Abort_ConnectAndAbort_ThrowsWebSocketExceptionWithmessage(Uri

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task Abort_SendAndAbort_Success(Uri server)
{
await TestCancellation(async (cws) =>
Expand All @@ -62,6 +64,7 @@ await TestCancellation(async (cws) =>

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task Abort_ReceiveAndAbort_Success(Uri server)
{
await TestCancellation(async (cws) =>
Expand All @@ -86,6 +89,7 @@ await cws.SendAsync(

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task Abort_CloseAndAbort_Success(Uri server)
{
await TestCancellation(async (cws) =>
Expand All @@ -110,6 +114,7 @@ await cws.SendAsync(

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45468", TestPlatforms.Browser)]
public async Task ClientWebSocket_Abort_CloseOutputAsync(Uri server)
{
await TestCancellation(async (cws) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ await cws.SendAsync(

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45468", TestPlatforms.Browser)]
public async Task CloseOutputAsync_Cancel_Success(Uri server)
{
await TestCancellation(async (cws) =>
Expand Down Expand Up @@ -130,6 +131,7 @@ public async Task ReceiveAsync_CancelThenReceive_ThrowsOperationCanceledExceptio

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task ReceiveAsync_ReceiveThenCancel_ThrowsOperationCanceledException(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand All @@ -146,6 +148,7 @@ public async Task ReceiveAsync_ReceiveThenCancel_ThrowsOperationCanceledExceptio

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45674", TestPlatforms.Browser)]
public async Task ReceiveAsync_AfterCancellationDoReceiveAsync_ThrowsWebSocketException(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static void Proxy_Roundtrips()

[OuterLoop]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/43751")]
public async Task Proxy_SetNull_ConnectsSuccessfully(Uri server)
{
for (int i = 0; i < 3; i++) // Connect and disconnect multiple times to exercise shared handler on netcoreapp
Expand Down
10 changes: 8 additions & 2 deletions src/libraries/System.Net.WebSockets.Client/tests/CloseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public async Task CloseAsync_ClientInitiatedClose_Success(Uri server)
var cts = new CancellationTokenSource(TimeOutMilliseconds);
Assert.Equal(WebSocketState.Open, cws.State);

var closeStatus = WebSocketCloseStatus.InvalidMessageType;
// See issue for Browser websocket differences https://github.com/dotnet/runtime/issues/45538
var closeStatus = PlatformDetection.IsBrowser ? WebSocketCloseStatus.NormalClosure : WebSocketCloseStatus.InvalidMessageType;

string closeDescription = "CloseAsync_InvalidMessageType";

await cws.CloseAsync(closeStatus, closeDescription, cts.Token);
Expand All @@ -101,6 +103,7 @@ public async Task CloseAsync_CloseDescriptionIsMaxLength_Success(Uri server)

[OuterLoop("Uses external server")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45531", TestPlatforms.Browser)]
public async Task CloseAsync_CloseDescriptionIsMaxLengthPlusOne_ThrowsArgumentException(Uri server)
{
string closeDescription = new string('C', CloseDescriptionMaxLength + 1);
Expand Down Expand Up @@ -132,7 +135,8 @@ public async Task CloseAsync_CloseDescriptionHasUnicode_Success(Uri server)
{
var cts = new CancellationTokenSource(TimeOutMilliseconds);

var closeStatus = WebSocketCloseStatus.InvalidMessageType;
// See issue for Browser websocket differences https://github.com/dotnet/runtime/issues/45538
var closeStatus = PlatformDetection.IsBrowser ? WebSocketCloseStatus.NormalClosure : WebSocketCloseStatus.InvalidMessageType;
string closeDescription = "CloseAsync_Containing\u016Cnicode.";

await cws.CloseAsync(closeStatus, closeDescription, cts.Token);
Expand Down Expand Up @@ -161,6 +165,7 @@ public async Task CloseAsync_CloseDescriptionIsNull_Success(Uri server)

[OuterLoop("Uses external server")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45468", TestPlatforms.Browser)]
public async Task CloseOutputAsync_ClientInitiated_CanReceive_CanClose(Uri server)
{
string message = "Hello WebSockets!";
Expand Down Expand Up @@ -247,6 +252,7 @@ await cws.SendAsync(

[OuterLoop("Uses external server")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45468", TestPlatforms.Browser)]
public async Task CloseOutputAsync_CloseDescriptionIsNull_Success(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public async Task EchoTextMessage_Success(Uri server)

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
[PlatformSpecific(~TestPlatforms.Browser)] // CustomHeaders not supported on browser
public async Task ConnectAsync_AddCustomHeaders_Success(Uri server)
{
using (var cws = new ClientWebSocket())
Expand Down Expand Up @@ -113,6 +114,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoHeadersServers))]
[PlatformSpecific(~TestPlatforms.Browser)] // Cookies not supported on browser
public async Task ConnectAsync_CookieHeaders_Success(Uri server)
{
using (var cws = new ClientWebSocket())
Expand Down Expand Up @@ -162,6 +164,7 @@ public async Task ConnectAsync_CookieHeaders_Success(Uri server)

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45583", TestPlatforms.Browser)]
public async Task ConnectAsync_PassNoSubProtocol_ServerRequires_ThrowsWebSocketException(Uri server)
{
const string AcceptedProtocol = "CustomProtocol";
Expand Down Expand Up @@ -229,6 +232,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri =>

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/42852", TestPlatforms.Browser)]
public async Task ConnectAndCloseAsync_UseProxyServer_ExpectedClosedState(Uri server)
{
using (var cws = new ClientWebSocket())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace System.Net.WebSockets.Client.Tests
{
[PlatformSpecific(~TestPlatforms.Browser)] // KeepAlive not supported on browser
public class KeepAliveTest : ClientWebSocketTestBase
{
public KeepAliveTest(ITestOutputHelper output) : base(output) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public async Task SendReceive_PartialMessageDueToSmallReceiveBuffer_Success(Uri

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45586", TestPlatforms.Browser)]
public async Task SendReceive_PartialMessageBeforeCompleteMessageArrives_Success(Uri server)
{
var rand = new Random();
Expand Down Expand Up @@ -130,6 +131,7 @@ public async Task SendReceive_PartialMessageBeforeCompleteMessageArrives_Success

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45586", TestPlatforms.Browser)]
public async Task SendAsync_SendCloseMessageType_ThrowsArgumentExceptionWithMessage(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down Expand Up @@ -217,6 +219,7 @@ public async Task SendAsync_MultipleOutstandingSendOperations_Throws(Uri server)

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45586", TestPlatforms.Browser)]
public async Task ReceiveAsync_MultipleOutstandingReceiveOperations_Throws(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down Expand Up @@ -281,6 +284,7 @@ await SendAsync(

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45586", TestPlatforms.Browser)]
public async Task SendAsync_SendZeroLengthPayloadAsEndOfMessage_Success(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down Expand Up @@ -459,6 +463,7 @@ await LoopbackServer.CreateServerAsync(async (server, url) =>

[OuterLoop("Uses external servers")]
[ConditionalTheory(nameof(WebSocketsSupported)), MemberData(nameof(EchoServers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45586", TestPlatforms.Browser)]
public async Task ZeroByteReceive_CompletesWhenDataAvailable(Uri server)
{
using (ClientWebSocket cws = await WebSocketHelper.GetConnectedWebSocket(server, TimeOutMilliseconds, _output))
Expand Down