From e164ad1a3ccae1caa55cd47e9d9124546510e659 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Sun, 23 May 2021 14:43:27 +0800 Subject: [PATCH 1/7] Add Assert for TlsHandler.MediationStream --- .../Tls/TlsHandler.MediationStream.NetCore.cs | 5 +++++ .../Tls/TlsHandler.MediationStream.NetFx.cs | 3 +++ .../Tls/TlsHandler.MediationStream.NetStandard20.cs | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetCore.cs b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetCore.cs index 766e2df02..4db76b0d3 100644 --- a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetCore.cs +++ b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetCore.cs @@ -39,6 +39,7 @@ partial class MediationStream public void SetSource(in ReadOnlyMemory source) { + Debug.Assert(SourceReadableBytes == 0); _input = source; _inputOffset = 0; _inputLength = 0; @@ -46,7 +47,9 @@ public void SetSource(in ReadOnlyMemory source) public void ResetSource() { + Debug.Assert(SourceReadableBytes == 0); _input = null; + _inputOffset = 0; _inputLength = 0; } @@ -60,6 +63,7 @@ public void ExpandSource(int count) if (sslBuffer.IsEmpty) { // there is no pending read operation - keep for future + Debug.Assert(_readCompletionSource == null); return; } _sslOwnedBuffer = default; @@ -87,6 +91,7 @@ public override ValueTask ReadAsync(Memory buffer, CancellationToken return new ValueTask(read); } + Debug.Assert(_readCompletionSource == null); Debug.Assert(_sslOwnedBuffer.IsEmpty); // take note of buffer - we will pass bytes there once available _sslOwnedBuffer = buffer; diff --git a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetFx.cs b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetFx.cs index cd6de86cd..8694f8d0b 100644 --- a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetFx.cs +++ b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetFx.cs @@ -45,6 +45,7 @@ partial class MediationStream public void SetSource(byte[] source, int offset) { + Debug.Assert(SourceReadableBytes == 0); _input = source; _inputStartOffset = offset; _inputOffset = 0; @@ -53,7 +54,9 @@ public void SetSource(byte[] source, int offset) public void ResetSource() { + Debug.Assert(SourceReadableBytes == 0); _input = null; + _inputOffset = 0; _inputLength = 0; } diff --git a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetStandard20.cs b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetStandard20.cs index c337ded64..d6c407734 100644 --- a/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetStandard20.cs +++ b/src/DotNetty.Handlers/Tls/TlsHandler.MediationStream.NetStandard20.cs @@ -39,6 +39,7 @@ partial class MediationStream public void SetSource(byte[] source, int offset) { + Debug.Assert(SourceReadableBytes == 0); _input = source; _inputStartOffset = offset; _inputOffset = 0; @@ -47,7 +48,9 @@ public void SetSource(byte[] source, int offset) public void ResetSource() { + Debug.Assert(SourceReadableBytes == 0); _input = null; + _inputOffset = 0; _inputLength = 0; } From 090b92dbe5729e03efe2d79f6e8e6cf209fffd13 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Sun, 23 May 2021 19:39:07 +0800 Subject: [PATCH 2/7] The old dotnetty.com.pfx use Sha1+RSA1024 instead of Sha256+RSA2048, and seems obsoleted and no longer work on net5.0+ubuntu20.04 Generated with ``` openssl genrsa -out ssl.key 2048 openssl req -new -x509 -key ssl.key -out dotnetty.com.cer -days 3650 -subj /CN=dotnetty.com openssl req -new -x509 -key ssl.key -out contoso.com.cer -days 3650 -subj /CN=contoso.com openssl pkcs12 -export -out dotnetty.com.pfx -inkey ssl.key -in dotnetty.com.cer openssl pkcs12 -export -out contoso.com.pfx -inkey ssl.key -in contoso.com.cer ``` password="password" --- shared/contoso.com.pfx | Bin 2503 -> 2389 bytes shared/dotnetty.com.pfx | Bin 1710 -> 2389 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/shared/contoso.com.pfx b/shared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.../DotNetty.Handlers.Tests/TlsHandlerTest.cs | 153 ++++++++++++++---- .../TestResourceHelper.cs | 38 +++-- 3 files changed, 156 insertions(+), 59 deletions(-) diff --git a/test/DotNetty.Handlers.Tests/SniHandlerTest.cs b/test/DotNetty.Handlers.Tests/SniHandlerTest.cs index 9ca2e9ca2..605dd4c71 100644 --- a/test/DotNetty.Handlers.Tests/SniHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/SniHandlerTest.cs @@ -32,11 +32,7 @@ static SniHandlerTest() X509Certificate2 tlsCertificate = TestResourceHelper.GetTestCertificate(); X509Certificate2 tlsCertificate2 = TestResourceHelper.GetTestCertificate2(); - //#if NETCOREAPP_3_0_GREATER - // SslProtocols serverProtocol = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? SslProtocols.Tls13 : SslProtocols.Tls12; - //#else - SslProtocols serverProtocol = SslProtocols.Tls12; - //#endif + SslProtocols serverProtocol = SslProtocols.None; SettingMap[tlsCertificate.GetNameInfo(X509NameType.DnsName, false)] = new ServerTlsSettings(tlsCertificate, false, false, serverProtocol); SettingMap[tlsCertificate2.GetNameInfo(X509NameType.DnsName, false)] = new ServerTlsSettings(tlsCertificate2, false, false, serverProtocol); } @@ -53,11 +49,7 @@ public static IEnumerable GetTlsReadTestData() new[] { 1 } }; var boolToggle = new[] { false, true }; - //#if NETCOREAPP_3_0_GREATER - // var protocols = new[] { RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? SslProtocols.Tls13 : SslProtocols.Tls12 }; - //#else - var protocols = new[] { SslProtocols.Tls12 }; - //#endif + var protocols = new[] { SslProtocols.None }; var writeStrategyFactories = new Func[] { () => new AsIsWriteStrategy() @@ -106,7 +98,8 @@ public async Task TlsRead(int[] frameLengths, bool isClient, IWriteStrategy writ #pragma warning disable CS1998 // 异步方法缺少 "await" 运算符,将以同步方式运行 await ReadOutboundAsync(async () => ch.ReadInbound(), expectedBuffer.ReadableBytes, finalReadBuffer, TestTimeout); #pragma warning restore CS1998 // 异步方法缺少 "await" 运算符,将以同步方式运行 - Assert.True(ByteBufferUtil.Equals(expectedBuffer, finalReadBuffer), $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); + if (!ByteBufferUtil.Equals(expectedBuffer, finalReadBuffer)) + Assert.True(false, $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); if (!isClient) { @@ -131,11 +124,7 @@ public static IEnumerable GetTlsWriteTestData() new[] { 1 } }; var boolToggle = new[] { false, true }; - //#if NETCOREAPP_3_0_GREATER - // var protocols = new[] { RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? SslProtocols.Tls13 : SslProtocols.Tls12 }; - //#else - var protocols = new[] { SslProtocols.Tls12 }; - //#endif + var protocols = new[] { SslProtocols.None }; return from frameLengths in lengthVariations @@ -186,7 +175,8 @@ await ReadOutboundAsync( return Unpooled.WrappedBuffer(readBuffer, 0, read); }, expectedBuffer.ReadableBytes, finalReadBuffer, TestTimeout); - Assert.True(ByteBufferUtil.Equals(expectedBuffer, finalReadBuffer), $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); + if (!ByteBufferUtil.Equals(expectedBuffer, finalReadBuffer)) + Assert.True(false, $"---Expected:\n{ByteBufferUtil.PrettyHexDump(expectedBuffer)}\n---Actual:\n{ByteBufferUtil.PrettyHexDump(finalReadBuffer)}"); if (!isClient) { diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 71da5f07a..0431c6e91 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -7,8 +7,9 @@ namespace DotNetty.Handlers.Tests using System.Collections.Generic; using System.Diagnostics; using System.Linq; + using System.Net; using System.Net.Security; - using System.Runtime.InteropServices; + using System.Net.Sockets; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; @@ -47,25 +48,30 @@ public static IEnumerable GetTlsReadTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; - var protocols = new List>(); - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - protocols.Add(Tuple.Create(SslProtocols.Tls, SslProtocols.Tls)); - protocols.Add(Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12)); + var protocols = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); + protocols.Add((SslProtocols.Tls, SslProtocols.Tls)); + protocols.Add((SslProtocols.Tls11, SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls12, SslProtocols.Tls12)); #if NETCOREAPP_3_0_GREATER - //protocols.Add(Tuple.Create(SslProtocols.Tls13, SslProtocols.Tls13)); + var tls13 = SslProtocols.Tls13; + protocols.Add((tls13, tls13)); +#else + var tls13 = SslProtocols.None; #endif - protocols.Add(Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); + if ((Platform.SupportedSslProtocols & tls13) != SslProtocols.None) + { + //Tls and Tls11 maybe unavailable in new platforms + protocols.Add((SslProtocols.Tls12 | tls13, SslProtocols.Tls11 | SslProtocols.Tls12)); + protocols.Add((SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls12 | tls13)); } else { - protocols.Add(Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12)); - protocols.Add(Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls11, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); } + + protocols = FilterPlatformAvailableProtocols(protocols); + var writeStrategyFactories = new Func[] { () => new AsIsWriteStrategy(), @@ -79,7 +85,7 @@ from frameLengths in lengthVariations from isClient in boolToggle from writeStrategyFactory in writeStrategyFactories from protocol in protocols - select new object[] { frameLengths, isClient, writeStrategyFactory(), protocol.Item1, protocol.Item2 }; + select new object[] { frameLengths, isClient, writeStrategyFactory(), protocol.serverProtocol, protocol.clientProtocol }; } @@ -147,31 +153,35 @@ public static IEnumerable GetTlsWriteTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 10) < 2 ? -1 : random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; - var protocols = new List>(); - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - protocols.Add(Tuple.Create(SslProtocols.Tls, SslProtocols.Tls)); - protocols.Add(Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12)); + var protocols = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); + protocols.Add((SslProtocols.Tls, SslProtocols.Tls)); + protocols.Add((SslProtocols.Tls11, SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls12, SslProtocols.Tls12)); #if NETCOREAPP_3_0_GREATER - //protocols.Add(Tuple.Create(SslProtocols.Tls13, SslProtocols.Tls13)); + var tls13 = SslProtocols.Tls13; + protocols.Add((tls13, tls13)); +#else + var tls13 = SslProtocols.None; #endif - protocols.Add(Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); + if ((Platform.SupportedSslProtocols & tls13) != SslProtocols.None) + { + //Tls and Tls11 maybe unavailable in new platforms + protocols.Add((SslProtocols.Tls12 | tls13, SslProtocols.Tls11 | SslProtocols.Tls12)); + protocols.Add((SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls12 | tls13)); } else { - protocols.Add(Tuple.Create(SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls12, SslProtocols.Tls12)); - protocols.Add(Tuple.Create(SslProtocols.Tls12 | SslProtocols.Tls11, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add(Tuple.Create(SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); + protocols.Add((SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); } + protocols = FilterPlatformAvailableProtocols(protocols); + return from frameLengths in lengthVariations from isClient in boolToggle from protocol in protocols - select new object[] { frameLengths, isClient, protocol.Item1, protocol.Item2 }; + select new object[] { frameLengths, isClient, protocol.serverProtocol, protocol.clientProtocol }; } [Theory] @@ -232,6 +242,31 @@ await ReadOutboundAsync( } } + static List<(SslProtocols serverProtocol, SslProtocols clientProtocol)> FilterPlatformAvailableProtocols(List<(SslProtocols serverProtocol, SslProtocols clientProtocol)> protocols) + { + var set = new HashSet<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); + var list = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(protocols.Count + 1); + + //Ensure there is at least one test available(SslProtocols.None: Allows the operating system to choose the best protocol to use, and to block protocols that are not secure.) + list.Add((SslProtocols.None, SslProtocols.None)); + + var supportedSslProtocols = Platform.SupportedSslProtocols; + if (supportedSslProtocols != SslProtocols.None) + { + foreach (var cur in protocols) + { + var (serverProtocol, clientProtocol) = cur; + serverProtocol &= supportedSslProtocols; + clientProtocol &= supportedSslProtocols; + if ((serverProtocol & clientProtocol) == SslProtocols.None) + continue; + if (set.Add((serverProtocol, clientProtocol))) + list.Add((serverProtocol, clientProtocol)); + } + } + return list; + } + static async Task> SetupStreamAndChannelAsync(bool isClient, IEventExecutor executor, IWriteStrategy writeStrategy, SslProtocols serverProtocol, SslProtocols clientProtocol, List writeTasks) { X509Certificate2 tlsCertificate = TestResourceHelper.GetTestCertificate(); @@ -378,5 +413,65 @@ public override void ChannelActive(IChannelHandlerContext context) } } } + + public static class Platform + { + public static readonly SslProtocols SupportedSslProtocols; + static Platform() + { + SslProtocols protocol = 0; + protocol |= CheckSslProtocol(SslProtocols.Tls); + protocol |= CheckSslProtocol(SslProtocols.Tls11); + protocol |= CheckSslProtocol(SslProtocols.Tls12); +#if NETCOREAPP_3_0_GREATER + protocol |= CheckSslProtocol(SslProtocols.Tls13); +#endif + SupportedSslProtocols = protocol; + } + + private static SslProtocols CheckSslProtocol(SslProtocols protocol) + { + X509Certificate2 tlsCertificate = TestResourceHelper.GetTestCertificate(); + string targetHost = tlsCertificate.GetNameInfo(X509NameType.SimpleName, false); + try + { + using (var server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + server.Bind(new IPEndPoint(IPAddress.Loopback, 0)); + server.Listen(1); + using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) + { + client.Connect(server.LocalEndPoint); + using (var a = new SslStream(new NetworkStream(server.Accept(), ownsSocket: true))) + using (var b = new SslStream(new NetworkStream(client, ownsSocket: true), false, (sender, certificate, chain, sslPolicyErrors) => true)) + { + Task.WhenAll( + Task.Run(async () => + { + using (b) + { + await b.AuthenticateAsClientAsync(targetHost, null, protocol, false); + Debug.Assert(b.SslProtocol == protocol); + } + }), + Task.Run(async () => + { + using (a) + { + await a.AuthenticateAsServerAsync(tlsCertificate, false, protocol, false); + Debug.Assert(a.SslProtocol == protocol); + } + })).WithTimeout(TimeSpan.FromSeconds(1)).GetAwaiter().GetResult(); + } + } + } + return protocol; + } + catch (AuthenticationException) + { + return SslProtocols.None; + } + } + } } } diff --git a/test/DotNetty.Tests.Common/TestResourceHelper.cs b/test/DotNetty.Tests.Common/TestResourceHelper.cs index fae5670ec..a1418a07e 100644 --- a/test/DotNetty.Tests.Common/TestResourceHelper.cs +++ b/test/DotNetty.Tests.Common/TestResourceHelper.cs @@ -9,30 +9,42 @@ namespace DotNetty.Tests.Common public static class TestResourceHelper { + static X509Certificate2 _testCert; + static X509Certificate2 _testCert2; + public static X509Certificate2 GetTestCertificate() { - byte[] certData; - using (Stream resStream = typeof(TestResourceHelper).GetTypeInfo().Assembly.GetManifestResourceStream(typeof(TestResourceHelper).Namespace + "." + "dotnetty.com.pfx")) - using (var memStream = new MemoryStream()) + var testCert = _testCert; + if (testCert is null) { - resStream.CopyTo(memStream); - certData = memStream.ToArray(); + byte[] certData; + using (Stream resStream = typeof(TestResourceHelper).GetTypeInfo().Assembly.GetManifestResourceStream(typeof(TestResourceHelper).Namespace + "." + "dotnetty.com.pfx")) + using (var memStream = new MemoryStream()) + { + resStream.CopyTo(memStream); + certData = memStream.ToArray(); + } + testCert = _testCert = new X509Certificate2(certData, "password"); } - return new X509Certificate2(certData, "password"); + return testCert; } public static X509Certificate2 GetTestCertificate2() { - byte[] certData; - using (Stream resStream = typeof(TestResourceHelper).GetTypeInfo().Assembly.GetManifestResourceStream(typeof(TestResourceHelper).Namespace + "." + "contoso.com.pfx")) - using (var memStream = new MemoryStream()) + var testCert2 = _testCert2; + if (testCert2 is null) { - resStream.CopyTo(memStream); - certData = memStream.ToArray(); + byte[] certData; + using (Stream resStream = typeof(TestResourceHelper).GetTypeInfo().Assembly.GetManifestResourceStream(typeof(TestResourceHelper).Namespace + "." + "contoso.com.pfx")) + using (var memStream = new MemoryStream()) + { + resStream.CopyTo(memStream); + certData = memStream.ToArray(); + } + testCert2 = _testCert2 = new X509Certificate2(certData, "password"); } - - return new X509Certificate2(certData, "password"); + return testCert2; } } } \ No newline at end of file From 6cc270d2f7b4ca59621b1cfb0af99cbf62450628 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Sun, 23 May 2021 22:05:20 +0800 Subject: [PATCH 4/7] Move test of SslProtocols to an independent group, no need to run too many tests for it --- .../DotNetty.Handlers.Tests/TlsHandlerTest.cs | 101 +++++++++++------- 1 file changed, 63 insertions(+), 38 deletions(-) diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 0431c6e91..9a965b466 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -48,6 +48,49 @@ public static IEnumerable GetTlsReadTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; + var protocols = new (SslProtocols serverProtocol, SslProtocols clientProtocol)[] { (SslProtocols.None, SslProtocols.None) }; + + var writeStrategyFactories = new Func[] + { + () => new AsIsWriteStrategy(), + () => new BatchingWriteStrategy(1, TimeSpan.FromMilliseconds(20), true), + () => new BatchingWriteStrategy(4096, TimeSpan.FromMilliseconds(20), true), + () => new BatchingWriteStrategy(32 * 1024, TimeSpan.FromMilliseconds(20), false) + }; + + return + from frameLengths in lengthVariations + from isClient in boolToggle + from writeStrategyFactory in writeStrategyFactories + from protocol in protocols + select new object[] { frameLengths, isClient, writeStrategyFactory(), protocol.serverProtocol, protocol.clientProtocol }; + } + + public static IEnumerable GetTlsReadTestProtocol() + { + var lengthVariations = + new[] + { + new[] { 1 }, + }; + var boolToggle = new[] { false, true }; + var protocols = GetTlsTestProtocol(); + + var writeStrategyFactories = new Func[] + { + () => new AsIsWriteStrategy() + }; + + return + from frameLengths in lengthVariations + from isClient in boolToggle + from writeStrategyFactory in writeStrategyFactories + from protocol in protocols + select new object[] { frameLengths, isClient, writeStrategyFactory(), protocol.serverProtocol, protocol.clientProtocol }; + } + + static List<(SslProtocols serverProtocol, SslProtocols clientProtocol)> GetTlsTestProtocol() + { var protocols = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); protocols.Add((SslProtocols.Tls, SslProtocols.Tls)); protocols.Add((SslProtocols.Tls11, SslProtocols.Tls11)); @@ -71,26 +114,12 @@ public static IEnumerable GetTlsReadTestData() } protocols = FilterPlatformAvailableProtocols(protocols); - - var writeStrategyFactories = new Func[] - { - () => new AsIsWriteStrategy(), - () => new BatchingWriteStrategy(1, TimeSpan.FromMilliseconds(20), true), - () => new BatchingWriteStrategy(4096, TimeSpan.FromMilliseconds(20), true), - () => new BatchingWriteStrategy(32 * 1024, TimeSpan.FromMilliseconds(20), false) - }; - - return - from frameLengths in lengthVariations - from isClient in boolToggle - from writeStrategyFactory in writeStrategyFactories - from protocol in protocols - select new object[] { frameLengths, isClient, writeStrategyFactory(), protocol.serverProtocol, protocol.clientProtocol }; + return protocols; } - [Theory] [MemberData(nameof(GetTlsReadTestData))] + [MemberData(nameof(GetTlsReadTestProtocol))] public async Task TlsRead(int[] frameLengths, bool isClient, IWriteStrategy writeStrategy, SslProtocols serverProtocol, SslProtocols clientProtocol) { this.Output.WriteLine($"frameLengths: {string.Join(", ", frameLengths)}"); @@ -153,29 +182,24 @@ public static IEnumerable GetTlsWriteTestData() Enumerable.Repeat(0, 30).Select(_ => random.Next(0, 10) < 2 ? -1 : random.Next(0, 17000)).ToArray() }; var boolToggle = new[] { false, true }; - var protocols = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); - protocols.Add((SslProtocols.Tls, SslProtocols.Tls)); - protocols.Add((SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add((SslProtocols.Tls12, SslProtocols.Tls12)); -#if NETCOREAPP_3_0_GREATER - var tls13 = SslProtocols.Tls13; - protocols.Add((tls13, tls13)); -#else - var tls13 = SslProtocols.None; -#endif - if ((Platform.SupportedSslProtocols & tls13) != SslProtocols.None) - { - //Tls and Tls11 maybe unavailable in new platforms - protocols.Add((SslProtocols.Tls12 | tls13, SslProtocols.Tls11 | SslProtocols.Tls12)); - protocols.Add((SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls12 | tls13)); - } - else - { - protocols.Add((SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add((SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); - } + var protocols = new (SslProtocols serverProtocol, SslProtocols clientProtocol)[] { (SslProtocols.None, SslProtocols.None) }; - protocols = FilterPlatformAvailableProtocols(protocols); + return + from frameLengths in lengthVariations + from isClient in boolToggle + from protocol in protocols + select new object[] { frameLengths, isClient, protocol.serverProtocol, protocol.clientProtocol }; + } + + public static IEnumerable GetTlsWriteTestProtocol() + { + var lengthVariations = + new[] + { + new[] { 1 } + }; + var boolToggle = new[] { false, true }; + var protocols = GetTlsTestProtocol(); return from frameLengths in lengthVariations @@ -186,6 +210,7 @@ from protocol in protocols [Theory] [MemberData(nameof(GetTlsWriteTestData))] + [MemberData(nameof(GetTlsWriteTestProtocol))] public async Task TlsWrite(int[] frameLengths, bool isClient, SslProtocols serverProtocol, SslProtocols clientProtocol) { this.Output.WriteLine($"frameLengths: {string.Join(", ", frameLengths)}"); From 9c9e5e49801ab98af942389510ddb33b8c241011 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Sun, 23 May 2021 22:43:29 +0800 Subject: [PATCH 5/7] Add an assert to ensure proper protocol is used by ssl handshake --- test/DotNetty.Handlers.Tests/TlsHandlerTest.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 9a965b466..0679d4dd2 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -343,6 +343,9 @@ static async Task> SetupStreamAndChannelAsync( { await Task.Run(() => driverStream.AuthenticateAsClientAsync(targetHost, null, clientProtocol, false)).WithTimeout(TimeSpan.FromSeconds(5)); } + if ((clientProtocol & serverProtocol) != SslProtocols.None) + Assert.True((clientProtocol & serverProtocol & driverStream.SslProtocol) != SslProtocols.None, "Unexpected ssl handshake protocol: " + driverStream.SslProtocol); + writeTasks.Clear(); return Tuple.Create(ch, driverStream); From e0802baa2bf801c6c5dc85064f5bbaaead2c8fb6 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Sun, 23 May 2021 23:09:43 +0800 Subject: [PATCH 6/7] Rework ssl handShake test with new assert --- .../DotNetty.Handlers.Tests/TlsHandlerTest.cs | 107 ++++++++++-------- 1 file changed, 60 insertions(+), 47 deletions(-) diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 0679d4dd2..907ba25b3 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -92,25 +92,21 @@ from protocol in protocols static List<(SslProtocols serverProtocol, SslProtocols clientProtocol)> GetTlsTestProtocol() { var protocols = new List<(SslProtocols serverProtocol, SslProtocols clientProtocol)>(); - protocols.Add((SslProtocols.Tls, SslProtocols.Tls)); - protocols.Add((SslProtocols.Tls11, SslProtocols.Tls11)); - protocols.Add((SslProtocols.Tls12, SslProtocols.Tls12)); -#if NETCOREAPP_3_0_GREATER - var tls13 = SslProtocols.Tls13; - protocols.Add((tls13, tls13)); -#else - var tls13 = SslProtocols.None; -#endif - if ((Platform.SupportedSslProtocols & tls13) != SslProtocols.None) + var supportedProtocolList = Platform.SupportedSslProtocolList; + foreach (var cur in supportedProtocolList) { - //Tls and Tls11 maybe unavailable in new platforms - protocols.Add((SslProtocols.Tls12 | tls13, SslProtocols.Tls11 | SslProtocols.Tls12)); - protocols.Add((SslProtocols.Tls11 | SslProtocols.Tls12, SslProtocols.Tls12 | tls13)); + protocols.Add((cur, cur)); } - else + int handShakeTestCnt = 0; + var supportedProtocols = Platform.AllSupportedSslProtocols; + foreach (var cur in supportedProtocolList) { - protocols.Add((SslProtocols.Tls12 | SslProtocols.Tls, SslProtocols.Tls12 | SslProtocols.Tls11)); - protocols.Add((SslProtocols.Tls | SslProtocols.Tls12, SslProtocols.Tls | SslProtocols.Tls11)); + protocols.Add((cur, supportedProtocols)); + protocols.Add((supportedProtocols, cur)); + + handShakeTestCnt++; + if (handShakeTestCnt >= 2) + break; } protocols = FilterPlatformAvailableProtocols(protocols); @@ -275,7 +271,7 @@ await ReadOutboundAsync( //Ensure there is at least one test available(SslProtocols.None: Allows the operating system to choose the best protocol to use, and to block protocols that are not secure.) list.Add((SslProtocols.None, SslProtocols.None)); - var supportedSslProtocols = Platform.SupportedSslProtocols; + var supportedSslProtocols = Platform.AllSupportedSslProtocols; if (supportedSslProtocols != SslProtocols.None) { foreach (var cur in protocols) @@ -444,20 +440,34 @@ public override void ChannelActive(IChannelHandlerContext context) public static class Platform { - public static readonly SslProtocols SupportedSslProtocols; + public static readonly SslProtocols AllSupportedSslProtocols; + public static readonly IReadOnlyList SupportedSslProtocolList; static Platform() { - SslProtocols protocol = 0; - protocol |= CheckSslProtocol(SslProtocols.Tls); - protocol |= CheckSslProtocol(SslProtocols.Tls11); - protocol |= CheckSslProtocol(SslProtocols.Tls12); + var allProtocol = new[] + { + SslProtocols.Tls, + SslProtocols.Tls11, + SslProtocols.Tls12, #if NETCOREAPP_3_0_GREATER - protocol |= CheckSslProtocol(SslProtocols.Tls13); + SslProtocols.Tls13, #endif - SupportedSslProtocols = protocol; + }; + var protocols = SslProtocols.None; + var list = new List(); + foreach (var cur in allProtocol) + { + if (CheckSslProtocol(cur)) + { + protocols |= cur; + list.Add(cur); + } + } + AllSupportedSslProtocols = protocols; + SupportedSslProtocolList = list.AsReadOnly(); } - private static SslProtocols CheckSslProtocol(SslProtocols protocol) + private static bool CheckSslProtocol(SslProtocols protocol) { X509Certificate2 tlsCertificate = TestResourceHelper.GetTestCertificate(); string targetHost = tlsCertificate.GetNameInfo(X509NameType.SimpleName, false); @@ -469,35 +479,38 @@ private static SslProtocols CheckSslProtocol(SslProtocols protocol) server.Listen(1); using (var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { - client.Connect(server.LocalEndPoint); - using (var a = new SslStream(new NetworkStream(server.Accept(), ownsSocket: true))) - using (var b = new SslStream(new NetworkStream(client, ownsSocket: true), false, (sender, certificate, chain, sslPolicyErrors) => true)) + Task.Run(async () => { - Task.WhenAll( - Task.Run(async () => - { - using (b) + client.Connect(server.LocalEndPoint); + using (var a = new SslStream(new NetworkStream(server.Accept(), ownsSocket: true))) + using (var b = new SslStream(new NetworkStream(client, ownsSocket: true), false, (sender, certificate, chain, sslPolicyErrors) => true)) + { + await Task.WhenAll( + Task.Run(async () => { - await b.AuthenticateAsClientAsync(targetHost, null, protocol, false); - Debug.Assert(b.SslProtocol == protocol); - } - }), - Task.Run(async () => - { - using (a) + using (b) + { + await b.AuthenticateAsClientAsync(targetHost, null, protocol, false); + Debug.Assert(b.SslProtocol == protocol); + } + }), + Task.Run(async () => { - await a.AuthenticateAsServerAsync(tlsCertificate, false, protocol, false); - Debug.Assert(a.SslProtocol == protocol); - } - })).WithTimeout(TimeSpan.FromSeconds(1)).GetAwaiter().GetResult(); - } + using (a) + { + await a.AuthenticateAsServerAsync(tlsCertificate, false, protocol, false); + Debug.Assert(a.SslProtocol == protocol); + } + })); + } + }).WithTimeout(TimeSpan.FromSeconds(1)).GetAwaiter().GetResult(); } } - return protocol; + return true; } - catch (AuthenticationException) + catch { - return SslProtocols.None; + return false; } } } From ae2874b93f6a5215f5f83269a6abb1c11020bb22 Mon Sep 17 00:00:00 2001 From: SilverFox Date: Mon, 24 May 2021 22:10:41 +0800 Subject: [PATCH 7/7] set DisableDiscoveryEnumeration = true for non-serializable MemberData --- .../HttpServerKeepAliveHandlerTest.cs | 6 +- test/DotNetty.Codecs.Http2.Tests/HpackTest.cs | 2 +- .../RoundTripTests.cs | 2 +- .../DotNetty.Handlers.Tests/SniHandlerTest.cs | 2 +- .../DotNetty.Handlers.Tests/TlsHandlerTest.cs | 4 +- .../AbstractSocketShutdownOutputByPeerTest.cs | 4 +- .../CompositeBufferGatheringWriteTest.cs | 16 +++--- .../Transport/Socket/SocketAutoReadTest.cs | 8 +-- .../Transport/Socket/SocketBufReleaseTest.cs | 8 +-- .../Transport/Socket/SocketCancelWriteTest.cs | 8 +-- .../SocketConditionalWritabilityTest.cs | 8 +-- .../Transport/Socket/SocketConnectTest.cs | 16 +++--- .../Socket/SocketDataReadInitialStateTest.cs | 16 +++--- .../Transport/Socket/SocketEchoTest.cs | 56 +++++++++---------- .../Socket/SocketExceptionHandlingTest.cs | 8 +-- .../Socket/SocketFixedLengthEchoTest.cs | 16 +++--- .../Socket/SocketGatheringWriteTest.cs | 40 ++++++------- .../Transport/Socket/SocketHalfClosedTest.cs | 14 ++--- .../Transport/Socket/SocketReadPendingTest.cs | 8 +-- .../Transport/Socket/SocketRstTest.cs | 16 +++--- .../Transport/Socket/SocketStringEchoTest.cs | 16 +++--- .../Socket/WriteBeforeRegisteredTest.cs | 4 +- .../SocketDatagramChannelMulticastTest.cs | 2 +- .../SocketDatagramChannelUnicastTest.cs | 2 +- 24 files changed, 141 insertions(+), 141 deletions(-) diff --git a/test/DotNetty.Codecs.Http.Tests/HttpServerKeepAliveHandlerTest.cs b/test/DotNetty.Codecs.Http.Tests/HttpServerKeepAliveHandlerTest.cs index 42c13e4cc..1007e809e 100644 --- a/test/DotNetty.Codecs.Http.Tests/HttpServerKeepAliveHandlerTest.cs +++ b/test/DotNetty.Codecs.Http.Tests/HttpServerKeepAliveHandlerTest.cs @@ -39,7 +39,7 @@ public static IEnumerable GetKeepAliveCases() => new[] }; [Theory] - [MemberData(nameof(GetKeepAliveCases))] + [MemberData(nameof(GetKeepAliveCases), DisableDiscoveryEnumeration = true)] public void KeepAlive(bool isKeepAliveResponseExpected, HttpVersion httpVersion, HttpResponseStatus responseStatus, string sendKeepAlive, int setSelfDefinedMessageLength, ICharSequence setResponseConnection) { var channel = new EmbeddedChannel(new HttpServerKeepAliveHandler()); @@ -66,7 +66,7 @@ public void KeepAlive(bool isKeepAliveResponseExpected, HttpVersion httpVersion, } [Theory] - [MemberData(nameof(GetKeepAliveCases))] + [MemberData(nameof(GetKeepAliveCases), DisableDiscoveryEnumeration = true)] #pragma warning disable xUnit1026 // Theory methods should use all of their parameters public void ConnectionCloseHeaderHandledCorrectly(bool isKeepAliveResponseExpected, HttpVersion httpVersion, HttpResponseStatus responseStatus, string sendKeepAlive, int setSelfDefinedMessageLength, ICharSequence setResponseConnection) #pragma warning restore xUnit1026 // Theory methods should use all of their parameters @@ -85,7 +85,7 @@ public void ConnectionCloseHeaderHandledCorrectly(bool isKeepAliveResponseExpect } [Theory] - [MemberData(nameof(GetKeepAliveCases))] + [MemberData(nameof(GetKeepAliveCases), DisableDiscoveryEnumeration = true)] public void PipelineKeepAlive(bool isKeepAliveResponseExpected, HttpVersion httpVersion, HttpResponseStatus responseStatus, string sendKeepAlive, int setSelfDefinedMessageLength, ICharSequence setResponseConnection) { var channel = new EmbeddedChannel(new HttpServerKeepAliveHandler()); diff --git a/test/DotNetty.Codecs.Http2.Tests/HpackTest.cs b/test/DotNetty.Codecs.Http2.Tests/HpackTest.cs index 957269d88..6d49eef8f 100644 --- a/test/DotNetty.Codecs.Http2.Tests/HpackTest.cs +++ b/test/DotNetty.Codecs.Http2.Tests/HpackTest.cs @@ -20,7 +20,7 @@ public static IEnumerable GetJsonFiles() } [Theory] - [MemberData(nameof(GetJsonFiles))] + [MemberData(nameof(GetJsonFiles), DisableDiscoveryEnumeration = true)] public void Test(FileInfo file) { using (var fs = file.Open(FileMode.Open)) diff --git a/test/DotNetty.Codecs.Protobuf.Tests/RoundTripTests.cs b/test/DotNetty.Codecs.Protobuf.Tests/RoundTripTests.cs index 75c02b8b2..f02dccc90 100644 --- a/test/DotNetty.Codecs.Protobuf.Tests/RoundTripTests.cs +++ b/test/DotNetty.Codecs.Protobuf.Tests/RoundTripTests.cs @@ -187,7 +187,7 @@ public static IEnumerable GetAddressBookCases() } [Theory] - [MemberData(nameof(GetAddressBookCases))] + [MemberData(nameof(GetAddressBookCases), DisableDiscoveryEnumeration = true)] public void Run1(AddressBook addressBook, bool isCompositeBuffer) { var channel = new EmbeddedChannel( diff --git a/test/DotNetty.Handlers.Tests/SniHandlerTest.cs b/test/DotNetty.Handlers.Tests/SniHandlerTest.cs index 605dd4c71..695d3cfc7 100644 --- a/test/DotNetty.Handlers.Tests/SniHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/SniHandlerTest.cs @@ -66,7 +66,7 @@ from targetHost in SettingMap.Keys [Theory] - [MemberData(nameof(GetTlsReadTestData))] + [MemberData(nameof(GetTlsReadTestData), DisableDiscoveryEnumeration = true)] public async Task TlsRead(int[] frameLengths, bool isClient, IWriteStrategy writeStrategy, SslProtocols protocol, string targetHost) { this.Output.WriteLine($"frameLengths: {string.Join(", ", frameLengths)}"); diff --git a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs index 907ba25b3..14d4ff9b3 100644 --- a/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs +++ b/test/DotNetty.Handlers.Tests/TlsHandlerTest.cs @@ -114,8 +114,8 @@ from protocol in protocols } [Theory] - [MemberData(nameof(GetTlsReadTestData))] - [MemberData(nameof(GetTlsReadTestProtocol))] + [MemberData(nameof(GetTlsReadTestData), DisableDiscoveryEnumeration = true)] + [MemberData(nameof(GetTlsReadTestProtocol), DisableDiscoveryEnumeration = true)] public async Task TlsRead(int[] frameLengths, bool isClient, IWriteStrategy writeStrategy, SslProtocols serverProtocol, SslProtocols clientProtocol) { this.Output.WriteLine($"frameLengths: {string.Join(", ", frameLengths)}"); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/AbstractSocketShutdownOutputByPeerTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/AbstractSocketShutdownOutputByPeerTest.cs index b77e117ac..b1ea5d775 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/AbstractSocketShutdownOutputByPeerTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/AbstractSocketShutdownOutputByPeerTest.cs @@ -21,7 +21,7 @@ public AbstractSocketShutdownOutputByPeerTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestShutdownOutput(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -72,7 +72,7 @@ public void TestShutdownOutput(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestShutdownOutputWithoutOption(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/CompositeBufferGatheringWriteTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/CompositeBufferGatheringWriteTest.cs index 4ab49055a..5b21522c1 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/CompositeBufferGatheringWriteTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/CompositeBufferGatheringWriteTest.cs @@ -21,7 +21,7 @@ public CompositeBufferGatheringWriteTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSingleCompositeBufferWrite(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -32,7 +32,7 @@ public Task TestSingleCompositeBufferWrite(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSingleCompositeBufferWrite_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -43,7 +43,7 @@ public Task TestSingleCompositeBufferWrite_LibuvClient(IByteBufferAllocator allo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSingleCompositeBufferWrite_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -54,7 +54,7 @@ public Task TestSingleCompositeBufferWrite_LibuvServer_SocketClient(IByteBufferA } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSingleCompositeBufferWrite_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -187,7 +187,7 @@ protected static void CompositeBufferPartialWriteDoesNotCorruptDataInitServerCon } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCompositeBufferPartialWriteDoesNotCorruptData(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -198,7 +198,7 @@ public Task TestCompositeBufferPartialWriteDoesNotCorruptData(IByteBufferAllocat } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCompositeBufferPartialWriteDoesNotCorruptData_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -209,7 +209,7 @@ public Task TestCompositeBufferPartialWriteDoesNotCorruptData_LibuvClient(IByteB } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCompositeBufferPartialWriteDoesNotCorruptData_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -220,7 +220,7 @@ public Task TestCompositeBufferPartialWriteDoesNotCorruptData_LibuvServer_Socket } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCompositeBufferPartialWriteDoesNotCorruptData_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketAutoReadTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketAutoReadTest.cs index 08baf2c90..648048c02 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketAutoReadTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketAutoReadTest.cs @@ -18,7 +18,7 @@ public SocketAutoReadTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffDuringReadOnlyReadsOneTime(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -29,7 +29,7 @@ public Task TestAutoReadOffDuringReadOnlyReadsOneTime(IByteBufferAllocator alloc } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffDuringReadOnlyReadsOneTime_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -40,7 +40,7 @@ public Task TestAutoReadOffDuringReadOnlyReadsOneTime_LibuvClient(IByteBufferAll } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffDuringReadOnlyReadsOneTime_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -51,7 +51,7 @@ public Task TestAutoReadOffDuringReadOnlyReadsOneTime_LibuvServer_SocketClient(I } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffDuringReadOnlyReadsOneTime_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketBufReleaseTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketBufReleaseTest.cs index daac8ad94..449d47709 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketBufReleaseTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketBufReleaseTest.cs @@ -17,7 +17,7 @@ public SocketBufReleaseTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestBufRelease(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -28,7 +28,7 @@ public Task TestBufRelease(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestBufRelease_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -39,7 +39,7 @@ public Task TestBufRelease_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestBufRelease_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -50,7 +50,7 @@ public Task TestBufRelease_LibuvServer_SocketClient(IByteBufferAllocator allocat } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestBufRelease_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketCancelWriteTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketCancelWriteTest.cs index 5500b0e40..87c28dfac 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketCancelWriteTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketCancelWriteTest.cs @@ -21,7 +21,7 @@ public SocketCancelWriteTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCancelWrite(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -32,7 +32,7 @@ public Task TestCancelWrite(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCancelWrite_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -43,7 +43,7 @@ public Task TestCancelWrite_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCancelWrite_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -54,7 +54,7 @@ public Task TestCancelWrite_LibuvServer_SocketClient(IByteBufferAllocator alloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestCancelWrite_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketConditionalWritabilityTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketConditionalWritabilityTest.cs index 30d7dea5a..68f4fb657 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketConditionalWritabilityTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketConditionalWritabilityTest.cs @@ -23,7 +23,7 @@ public SocketConditionalWritabilityTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestConditionalWritability(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -34,7 +34,7 @@ public Task TestConditionalWritability(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestConditionalWritability_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -45,7 +45,7 @@ public Task TestConditionalWritability_LibuvClient(IByteBufferAllocator allocato } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestConditionalWritability_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -56,7 +56,7 @@ public Task TestConditionalWritability_LibuvServer_SocketClient(IByteBufferAlloc } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestConditionalWritability_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketConnectTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketConnectTest.cs index 25639639b..aa49470ed 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketConnectTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketConnectTest.cs @@ -29,7 +29,7 @@ public SocketConnectTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestLocalAddressAfterConnect(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -40,7 +40,7 @@ public Task TestLocalAddressAfterConnect(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestLocalAddressAfterConnect_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -51,7 +51,7 @@ public Task TestLocalAddressAfterConnect_LibuvClient(IByteBufferAllocator alloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestLocalAddressAfterConnect_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -62,7 +62,7 @@ public Task TestLocalAddressAfterConnect_LibuvServer_SocketClient(IByteBufferAll } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestLocalAddressAfterConnect_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -122,7 +122,7 @@ public override void ChannelActive(IChannelHandlerContext ctx) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestChannelEventsFiredWhenClosedDirectly(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -133,7 +133,7 @@ public Task TestChannelEventsFiredWhenClosedDirectly(IByteBufferAllocator alloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestChannelEventsFiredWhenClosedDirectly_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -144,7 +144,7 @@ public Task TestChannelEventsFiredWhenClosedDirectly_LibuvClient(IByteBufferAllo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestChannelEventsFiredWhenClosedDirectly_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -155,7 +155,7 @@ public Task TestChannelEventsFiredWhenClosedDirectly_LibuvServer_SocketClient(IB } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestChannelEventsFiredWhenClosedDirectly_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketDataReadInitialStateTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketDataReadInitialStateTest.cs index 50aeeebc1..d3a15d4e4 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketDataReadInitialStateTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketDataReadInitialStateTest.cs @@ -18,7 +18,7 @@ public SocketDataReadInitialStateTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffNoDataReadUntilReadCalled(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -29,7 +29,7 @@ public Task TestAutoReadOffNoDataReadUntilReadCalled(IByteBufferAllocator alloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffNoDataReadUntilReadCalled_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -40,7 +40,7 @@ public Task TestAutoReadOffNoDataReadUntilReadCalled_LibuvClient(IByteBufferAllo } [Theory(Skip = "TODO 暂时忽略,单独运行可通过测试")] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffNoDataReadUntilReadCalled_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -51,7 +51,7 @@ public Task TestAutoReadOffNoDataReadUntilReadCalled_LibuvServer_SocketClient(IB } [Theory(Skip = "TODO 暂时忽略,单独运行可通过测试")] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOffNoDataReadUntilReadCalled_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -151,7 +151,7 @@ public override void ChannelRead(IChannelHandlerContext ctx, object msg) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOnDataReadImmediately(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -162,7 +162,7 @@ public Task TestAutoReadOnDataReadImmediately(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOnDataReadImmediately_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -173,7 +173,7 @@ public Task TestAutoReadOnDataReadImmediately_LibuvClient(IByteBufferAllocator a } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOnDataReadImmediately_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -184,7 +184,7 @@ public Task TestAutoReadOnDataReadImmediately_LibuvServer_SocketClient(IByteBuff } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestAutoReadOnDataReadImmediately_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketEchoTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketEchoTest.cs index 52d81df8b..2004beb3e 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketEchoTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketEchoTest.cs @@ -32,7 +32,7 @@ public void Dispose() } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEcho(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -43,7 +43,7 @@ public Task TestSimpleEcho(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEcho_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -54,7 +54,7 @@ public Task TestSimpleEcho_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEcho_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -65,7 +65,7 @@ public Task TestSimpleEcho_LibuvServer_SocketClient(IByteBufferAllocator allocat } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEcho_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -91,7 +91,7 @@ private async Task TestSimpleEcho0(ServerBootstrap sb, Bootstrap cb) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -102,7 +102,7 @@ public Task TestSimpleEchoNotAutoRead(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -113,7 +113,7 @@ public Task TestSimpleEchoNotAutoRead_LibuvClient(IByteBufferAllocator allocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -124,7 +124,7 @@ public Task TestSimpleEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferAlloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -150,7 +150,7 @@ private async Task TestSimpleEchoNotAutoRead0(ServerBootstrap sb, Bootstrap cb) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutor(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -161,7 +161,7 @@ public Task TestSimpleEchoWithAdditionalExecutor(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutor_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -172,7 +172,7 @@ public Task TestSimpleEchoWithAdditionalExecutor_LibuvClient(IByteBufferAllocato } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutor_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -183,7 +183,7 @@ public Task TestSimpleEchoWithAdditionalExecutor_LibuvServer_SocketClient(IByteB } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutor_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -209,7 +209,7 @@ private async Task TestSimpleEchoWithAdditionalExecutor0(ServerBootstrap sb, Boo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -220,7 +220,7 @@ public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead(IByteBufferAllocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -231,7 +231,7 @@ public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead_LibuvClient(IByteBuf } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -242,7 +242,7 @@ public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead_LibuvServer_SocketCl } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -268,7 +268,7 @@ private async Task TestSimpleEchoWithAdditionalExecutorNotAutoRead0(ServerBootst } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromise(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -279,7 +279,7 @@ public Task TestSimpleEchoWithVoidPromise(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromise_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -290,7 +290,7 @@ public Task TestSimpleEchoWithVoidPromise_LibuvClient(IByteBufferAllocator alloc } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromise_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -301,7 +301,7 @@ public Task TestSimpleEchoWithVoidPromise_LibuvServer_SocketClient(IByteBufferAl } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromise_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -327,7 +327,7 @@ private async Task TestSimpleEchoWithVoidPromise0(ServerBootstrap sb, Bootstrap } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromiseNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -338,7 +338,7 @@ public Task TestSimpleEchoWithVoidPromiseNotAutoRead(IByteBufferAllocator alloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromiseNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -349,7 +349,7 @@ public Task TestSimpleEchoWithVoidPromiseNotAutoRead_LibuvClient(IByteBufferAllo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromiseNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -360,7 +360,7 @@ public Task TestSimpleEchoWithVoidPromiseNotAutoRead_LibuvServer_SocketClient(IB } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithVoidPromiseNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -386,7 +386,7 @@ private async Task TestSimpleEchoWithVoidPromiseNotAutoRead0(ServerBootstrap sb, } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -397,7 +397,7 @@ public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise(IByteBufferAlloca } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -408,7 +408,7 @@ public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise_LibuvClient(IByte } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -419,7 +419,7 @@ public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise_LibuvServer_Socke } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestSimpleEchoWithAdditionalExecutorAndVoidPromise_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketExceptionHandlingTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketExceptionHandlingTest.cs index 999240e88..683edc46f 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketExceptionHandlingTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketExceptionHandlingTest.cs @@ -28,7 +28,7 @@ public SocketExceptionHandlingTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -39,7 +39,7 @@ public Task TestReadPendingIsResetAfterEachRead(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -50,7 +50,7 @@ public Task TestReadPendingIsResetAfterEachRead_LibuvClient(IByteBufferAllocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -61,7 +61,7 @@ public Task TestReadPendingIsResetAfterEachRead_LibuvServer_SocketClient(IByteBu } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketFixedLengthEchoTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketFixedLengthEchoTest.cs index a3e59ae78..0e5df35f2 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketFixedLengthEchoTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketFixedLengthEchoTest.cs @@ -31,7 +31,7 @@ public SocketFixedLengthEchoTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEcho(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -42,7 +42,7 @@ public Task TestFixedLengthEcho(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEcho_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -53,7 +53,7 @@ public Task TestFixedLengthEcho_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEcho_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -64,7 +64,7 @@ public Task TestFixedLengthEcho_LibuvServer_SocketClient(IByteBufferAllocator al } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEcho_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -90,7 +90,7 @@ private async Task TestFixedLengthEcho0(ServerBootstrap sb, Bootstrap cb) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEchoNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -101,7 +101,7 @@ public Task TestFixedLengthEchoNotAutoRead(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEchoNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -112,7 +112,7 @@ public Task TestFixedLengthEchoNotAutoRead_LibuvClient(IByteBufferAllocator allo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -123,7 +123,7 @@ public Task TestFixedLengthEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferA } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestFixedLengthEchoNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketGatheringWriteTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketGatheringWriteTest.cs index 44c129103..683e0d968 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketGatheringWriteTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketGatheringWriteTest.cs @@ -34,7 +34,7 @@ public void Dispose() } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWrite(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -45,7 +45,7 @@ public Task TestGatheringWrite(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWrite_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -56,7 +56,7 @@ public Task TestGatheringWrite_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWrite_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -67,7 +67,7 @@ public Task TestGatheringWrite_LibuvServer_SocketClient(IByteBufferAllocator all } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWrite_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -93,7 +93,7 @@ private async Task TestGatheringWrite0(ServerBootstrap sb, Bootstrap cb) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -104,7 +104,7 @@ public Task TestGatheringWriteNotAutoRead(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -115,7 +115,7 @@ public Task TestGatheringWriteNotAutoRead_LibuvClient(IByteBufferAllocator alloc } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -126,7 +126,7 @@ public Task TestGatheringWriteNotAutoRead_LibuvServer_SocketClient(IByteBufferAl } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -152,7 +152,7 @@ private async Task TestGatheringWriteNotAutoRead0(ServerBootstrap sb, Bootstrap } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithComposite(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -163,7 +163,7 @@ public Task TestGatheringWriteWithComposite(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithComposite_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -174,7 +174,7 @@ public Task TestGatheringWriteWithComposite_LibuvClient(IByteBufferAllocator all } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithComposite_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -185,7 +185,7 @@ public Task TestGatheringWriteWithComposite_LibuvServer_SocketClient(IByteBuffer } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithComposite_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -211,7 +211,7 @@ private async Task TestGatheringWriteWithComposite0(ServerBootstrap sb, Bootstra } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithCompositeNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -222,7 +222,7 @@ public Task TestGatheringWriteWithCompositeNotAutoRead(IByteBufferAllocator allo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithCompositeNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -233,7 +233,7 @@ public Task TestGatheringWriteWithCompositeNotAutoRead_LibuvClient(IByteBufferAl } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithCompositeNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -244,7 +244,7 @@ public Task TestGatheringWriteWithCompositeNotAutoRead_LibuvServer_SocketClient( } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteWithCompositeNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -271,7 +271,7 @@ private async Task TestGatheringWriteWithCompositeNotAutoRead0(ServerBootstrap s // Test for https://github.com/netty/netty/issues/2647 [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteBig(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -282,7 +282,7 @@ public Task TestGatheringWriteBig(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteBig_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -293,7 +293,7 @@ public Task TestGatheringWriteBig_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteBig_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -304,7 +304,7 @@ public Task TestGatheringWriteBig_LibuvServer_SocketClient(IByteBufferAllocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestGatheringWriteBig_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketHalfClosedTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketHalfClosedTest.cs index 38281c1ed..cf5dc1079 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketHalfClosedTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketHalfClosedTest.cs @@ -20,7 +20,7 @@ public SocketHalfClosedTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestHalfClosureOnlyOneEventWhenAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -113,7 +113,7 @@ public override void ExceptionCaught(IChannelHandlerContext ctx, Exception cause } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestAllDataReadAfterHalfClosure(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -276,7 +276,7 @@ public override void ExceptionCaught(IChannelHandlerContext ctx, Exception cause } //[Theory] - //[MemberData(nameof(GetAllocators))] + //[MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] [Fact(Skip = "TestAutoCloseFalseDoesShutdownOutput")] public void TestAutoCloseFalseDoesShutdownOutput(/*IByteBufferAllocator allocator*/) { @@ -509,7 +509,7 @@ private void CheckPrematureClose() } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestAllDataReadClosure(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -520,7 +520,7 @@ public void TestAllDataReadClosure(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestAllDataReadClosure_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -531,7 +531,7 @@ public void TestAllDataReadClosure_LibuvClient(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestAllDataReadClosure_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -542,7 +542,7 @@ public void TestAllDataReadClosure_LibuvServer_SocketClient(IByteBufferAllocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void TestAllDataReadClosure_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketReadPendingTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketReadPendingTest.cs index fe9d6d02b..3bbda012a 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketReadPendingTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketReadPendingTest.cs @@ -18,7 +18,7 @@ public SocketReadPendingTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -29,7 +29,7 @@ public Task TestReadPendingIsResetAfterEachRead(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -40,7 +40,7 @@ public Task TestReadPendingIsResetAfterEachRead_LibuvClient(IByteBufferAllocator } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -51,7 +51,7 @@ public Task TestReadPendingIsResetAfterEachRead_LibuvServer_SocketClient(IByteBu } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestReadPendingIsResetAfterEachRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketRstTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketRstTest.cs index 366856a13..8a5c1f646 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketRstTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketRstTest.cs @@ -29,7 +29,7 @@ public SocketRstTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestSoLingerZeroCausesOnlyRstOnClose(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -50,7 +50,7 @@ public async Task TestSoLingerZeroCausesOnlyRstOnClose(IByteBufferAllocator allo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestSoLingerZeroCausesOnlyRstOnClose_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -71,7 +71,7 @@ public async Task TestSoLingerZeroCausesOnlyRstOnClose_LibuvClient(IByteBufferAl } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestSoLingerZeroCausesOnlyRstOnClose_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -92,7 +92,7 @@ public async Task TestSoLingerZeroCausesOnlyRstOnClose_LibuvServer_SocketClient( } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestSoLingerZeroCausesOnlyRstOnClose_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -153,7 +153,7 @@ private async Task TestSoLingerZeroCausesOnlyRstOnClose0(ServerBootstrap sb, Boo } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestNoRstIfSoLingerOnClose(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -174,7 +174,7 @@ public async Task TestNoRstIfSoLingerOnClose(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestNoRstIfSoLingerOnClose_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -195,7 +195,7 @@ public async Task TestNoRstIfSoLingerOnClose_LibuvClient(IByteBufferAllocator al } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestNoRstIfSoLingerOnClose_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -216,7 +216,7 @@ public async Task TestNoRstIfSoLingerOnClose_LibuvServer_SocketClient(IByteBuffe } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public async Task TestNoRstIfSoLingerOnClose_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/SocketStringEchoTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/SocketStringEchoTest.cs index 5da9d407a..4dc64409d 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/SocketStringEchoTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/SocketStringEchoTest.cs @@ -43,7 +43,7 @@ public SocketStringEchoTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEcho(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -54,7 +54,7 @@ public Task TestStringEcho(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEcho_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -65,7 +65,7 @@ public Task TestStringEcho_LibuvClient(IByteBufferAllocator allocator) } [Theory()] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEcho_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -76,7 +76,7 @@ public Task TestStringEcho_LibuvServer_SocketClient(IByteBufferAllocator allocat } [Theory()] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEcho_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -103,7 +103,7 @@ private async Task TestStringEcho0(ServerBootstrap sb, Bootstrap cb) [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEchoNotAutoRead(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -114,7 +114,7 @@ public Task TestStringEchoNotAutoRead(IByteBufferAllocator allocator) } [Theory()] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEchoNotAutoRead_LibuvClient(IByteBufferAllocator allocator) { var sb = DefaultServerBootstrapFactory.Instance.NewInstance(); @@ -125,7 +125,7 @@ public Task TestStringEchoNotAutoRead_LibuvClient(IByteBufferAllocator allocator } [Theory()] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); @@ -136,7 +136,7 @@ public Task TestStringEchoNotAutoRead_LibuvServer_SocketClient(IByteBufferAlloca } [Theory()] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public Task TestStringEchoNotAutoRead_LibuvServer_LibuvClient(IByteBufferAllocator allocator) { var sb = LibuvServerBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Suite.Tests/Transport/Socket/WriteBeforeRegisteredTest.cs b/test/DotNetty.Suite.Tests/Transport/Socket/WriteBeforeRegisteredTest.cs index fced79abb..57c894695 100644 --- a/test/DotNetty.Suite.Tests/Transport/Socket/WriteBeforeRegisteredTest.cs +++ b/test/DotNetty.Suite.Tests/Transport/Socket/WriteBeforeRegisteredTest.cs @@ -16,7 +16,7 @@ public WriteBeforeRegisteredTest(ITestOutputHelper output) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void WriteBeforeConnect(IByteBufferAllocator allocator) { var cb = DefaultClientBootstrapFactory.Instance.NewInstance(); @@ -26,7 +26,7 @@ public void WriteBeforeConnect(IByteBufferAllocator allocator) } [Theory] - [MemberData(nameof(GetAllocators))] + [MemberData(nameof(GetAllocators), DisableDiscoveryEnumeration = true)] public void LibuvWriteBeforeConnect(IByteBufferAllocator allocator) { var cb = LibuvClientBootstrapFactory.Instance.NewInstance(); diff --git a/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelMulticastTest.cs b/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelMulticastTest.cs index c0905417b..71337e90e 100644 --- a/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelMulticastTest.cs +++ b/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelMulticastTest.cs @@ -94,7 +94,7 @@ public static IEnumerable GetData() } [Theory] - [MemberData(nameof(GetData))] + [MemberData(nameof(GetData), DisableDiscoveryEnumeration = true)] public void Multicast(AddressFamily addressFamily, IByteBufferAllocator allocator) { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) diff --git a/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelUnicastTest.cs b/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelUnicastTest.cs index 8e9a93cd1..d34fe9946 100644 --- a/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelUnicastTest.cs +++ b/test/DotNetty.Transport.Tests/Channel/Sockets/SocketDatagramChannelUnicastTest.cs @@ -144,7 +144,7 @@ public static IEnumerable GetData() } [Theory] - [MemberData(nameof(GetData))] + [MemberData(nameof(GetData), DisableDiscoveryEnumeration = true)] public void SimpleSend(IByteBuffer source, bool bindClient, IByteBufferAllocator allocator, AddressFamily addressFamily, byte[] expectedData, int count) { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))