From 6bc8d0df16e1fb87fb44ac99098e94fc8c491647 Mon Sep 17 00:00:00 2001 From: Mariano Barrios Date: Thu, 8 Jun 2023 18:23:30 +0200 Subject: [PATCH] Make tests lighter --- src/test/scala/tlschannel/BlockingTest.scala | 4 ++-- src/test/scala/tlschannel/ConcurrentTest.scala | 2 +- src/test/scala/tlschannel/NullEngineTest.scala | 4 ++-- src/test/scala/tlschannel/NullMultiNonBlockingTest.scala | 2 +- src/test/scala/tlschannel/async/AsyncCloseTest.scala | 2 +- src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala | 2 +- src/test/scala/tlschannel/async/AsyncShutdownTest.scala | 4 ++-- src/test/scala/tlschannel/async/AsyncTest.scala | 2 +- src/test/scala/tlschannel/async/AsyncTimeoutTest.scala | 6 +++--- src/test/scala/tlschannel/async/PseudoAsyncTest.scala | 4 ++-- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/scala/tlschannel/BlockingTest.scala b/src/test/scala/tlschannel/BlockingTest.scala index 2cf33652..b5b627a9 100644 --- a/src/test/scala/tlschannel/BlockingTest.scala +++ b/src/test/scala/tlschannel/BlockingTest.scala @@ -23,7 +23,7 @@ class BlockingTest extends StrictLogging { @TestFactory def testHalfDuplexWireRenegotiations(): util.Collection[DynamicTest] = { println("testHalfDuplexWireRenegotiations():") - val sizes = LazyList.iterate(1)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(1)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for ((size1, size2) <- sizes zip sizes.reverse) yield { DynamicTest.dynamicTest( s"testHalfDuplexWireRenegotiations() - size1=$size1, size2=$size2", @@ -46,7 +46,7 @@ class BlockingTest extends StrictLogging { @TestFactory def testFullDuplex(): util.Collection[DynamicTest] = { println("testFullDuplex():") - val sizes = LazyList.iterate(1)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(1)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for ((size1, size2) <- sizes zip sizes.reverse) yield { DynamicTest.dynamicTest( s"testFullDuplex() - size1=$size1,size2=$size2", diff --git a/src/test/scala/tlschannel/ConcurrentTest.scala b/src/test/scala/tlschannel/ConcurrentTest.scala index 54627fbe..eb49ff83 100644 --- a/src/test/scala/tlschannel/ConcurrentTest.scala +++ b/src/test/scala/tlschannel/ConcurrentTest.scala @@ -13,7 +13,7 @@ class ConcurrentTest extends StrictLogging { val sslContextFactory = new SslContextFactory val factory = new SocketPairFactory(sslContextFactory.defaultContext) - val dataSize = 500_000_000 + val dataSize = 250_000_000 val bufferSize = 2000 /** Test several parties writing concurrently diff --git a/src/test/scala/tlschannel/NullEngineTest.scala b/src/test/scala/tlschannel/NullEngineTest.scala index 87cd0dd3..c7ff2300 100644 --- a/src/test/scala/tlschannel/NullEngineTest.scala +++ b/src/test/scala/tlschannel/NullEngineTest.scala @@ -28,7 +28,7 @@ class NullEngineTest extends StrictLogging { @TestFactory def testHalfDuplexHeapBuffers(): util.Collection[DynamicTest] = { println("testHalfDuplexHeapBuffers():") - val sizes = LazyList.iterate(512)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(512)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for (size1 <- sizes) yield { DynamicTest.dynamicTest( s"testHalfDuplexHeapBuffers() - size1=$size1", @@ -47,7 +47,7 @@ class NullEngineTest extends StrictLogging { @TestFactory def testHalfDuplexDirectBuffers(): util.Collection[DynamicTest] = { println("testHalfDuplexDirectBuffers():") - val sizes = LazyList.iterate(512)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(512)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for (size1 <- sizes) yield { DynamicTest.dynamicTest( s"Testing sizes: size1=$size1", diff --git a/src/test/scala/tlschannel/NullMultiNonBlockingTest.scala b/src/test/scala/tlschannel/NullMultiNonBlockingTest.scala index 440cb3e9..9f539dae 100644 --- a/src/test/scala/tlschannel/NullMultiNonBlockingTest.scala +++ b/src/test/scala/tlschannel/NullMultiNonBlockingTest.scala @@ -15,7 +15,7 @@ class NullMultiNonBlockingTest { val sslContextFactory = new SslContextFactory val factory = new SocketPairFactory(sslContextFactory.defaultContext) val dataSize = 10 * 1024 * 1024 - val totalConnections = 150 + val totalConnections = 50 @Test def testRunTasksInNonBlockingLoop(): Unit = { diff --git a/src/test/scala/tlschannel/async/AsyncCloseTest.scala b/src/test/scala/tlschannel/async/AsyncCloseTest.scala index 6f74d7e6..8e2b6be0 100644 --- a/src/test/scala/tlschannel/async/AsyncCloseTest.scala +++ b/src/test/scala/tlschannel/async/AsyncCloseTest.scala @@ -23,7 +23,7 @@ class AsyncCloseTest extends AsyncTestBase { * Closing sockets registered in an asynchronous channel group is inherently racy, using repetitions to try to catch * most races. */ - val repetitions = 500 + val repetitions = 250 // should throw an CancellationException (or ClosedChannelException) when closing the group while reading @Test diff --git a/src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala b/src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala index 4cf9b0d3..adcea7bf 100644 --- a/src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala +++ b/src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala @@ -19,7 +19,7 @@ class AsyncQuickCloseTest extends AsyncTestBase { * Closing sockets registered in an asynchronous channel group is inherently racy, using repetitions to try to catch * most races. */ - val repetitions = 500 + val repetitions = 250 val bufferSize = 10000 diff --git a/src/test/scala/tlschannel/async/AsyncShutdownTest.scala b/src/test/scala/tlschannel/async/AsyncShutdownTest.scala index 8f9d50ec..5284388d 100644 --- a/src/test/scala/tlschannel/async/AsyncShutdownTest.scala +++ b/src/test/scala/tlschannel/async/AsyncShutdownTest.scala @@ -22,7 +22,7 @@ class AsyncShutdownTest extends AsyncTestBase { def testImmediateShutdown(): Unit = { println("testImmediateShutdown():") val channelGroup = new AsynchronousTlsChannelGroup() - val socketPairCount = 100 + val socketPairCount = 50 val socketPairs = factory.asyncN(null, channelGroup, socketPairCount, runTasks = true) for (AsyncSocketPair(client, server) <- socketPairs) { val writeBuffer = ByteBuffer.allocate(bufferSize) @@ -48,7 +48,7 @@ class AsyncShutdownTest extends AsyncTestBase { def testNonImmediateShutdown(): Unit = { println("testNonImmediateShutdown():") val channelGroup = new AsynchronousTlsChannelGroup() - val socketPairCount = 100 + val socketPairCount = 50 val socketPairs = factory.asyncN(null, channelGroup, socketPairCount, runTasks = true) for (AsyncSocketPair(client, server) <- socketPairs) { val writeBuffer = ByteBuffer.allocate(bufferSize) diff --git a/src/test/scala/tlschannel/async/AsyncTest.scala b/src/test/scala/tlschannel/async/AsyncTest.scala index 6e520468..4dee8acd 100644 --- a/src/test/scala/tlschannel/async/AsyncTest.scala +++ b/src/test/scala/tlschannel/async/AsyncTest.scala @@ -12,7 +12,7 @@ class AsyncTest extends AsyncTestBase { val sslContextFactory = new SslContextFactory val factory = new SocketPairFactory(sslContextFactory.defaultContext) - val socketPairCount = 120 + val socketPairCount = 50 // real engine - run tasks @Test diff --git a/src/test/scala/tlschannel/async/AsyncTimeoutTest.scala b/src/test/scala/tlschannel/async/AsyncTimeoutTest.scala index b6bb7dbb..ae971e8b 100644 --- a/src/test/scala/tlschannel/async/AsyncTimeoutTest.scala +++ b/src/test/scala/tlschannel/async/AsyncTimeoutTest.scala @@ -22,7 +22,7 @@ class AsyncTimeoutTest extends AsyncTestBase { val bufferSize = 10 - val repetitions = 1000 + val repetitions = 50 // scheduled timeout @Test @@ -32,7 +32,7 @@ class AsyncTimeoutTest extends AsyncTestBase { val successWrites = new LongAdder val successReads = new LongAdder for (_ <- 1 to repetitions) { - val socketPairCount = 100 + val socketPairCount = 50 val socketPairs = factory.asyncN(null, channelGroup, socketPairCount, runTasks = true) val latch = new CountDownLatch(socketPairCount * 2) for (AsyncSocketPair(client, server) <- socketPairs) { @@ -114,7 +114,7 @@ class AsyncTimeoutTest extends AsyncTestBase { var successfulWriteCancellations = 0 var successfulReadCancellations = 0 for (_ <- 1 to repetitions) { - val socketPairCount = 100 + val socketPairCount = 50 val socketPairs = factory.asyncN(null, channelGroup, socketPairCount, runTasks = true) val futures = for (AsyncSocketPair(client, server) <- socketPairs) yield { val writeBuffer = ByteBuffer.allocate(bufferSize) diff --git a/src/test/scala/tlschannel/async/PseudoAsyncTest.scala b/src/test/scala/tlschannel/async/PseudoAsyncTest.scala index 01631cd6..a2a06966 100644 --- a/src/test/scala/tlschannel/async/PseudoAsyncTest.scala +++ b/src/test/scala/tlschannel/async/PseudoAsyncTest.scala @@ -24,7 +24,7 @@ class PseudoAsyncTest extends StrictLogging { // test a half-duplex interaction, with renegotiation before reversing the direction of the flow (as in HTTP) @TestFactory def testHalfDuplex(): util.Collection[DynamicTest] = { - val sizes = LazyList.iterate(1)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(1)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for ((size1, size2) <- sizes zip sizes.reverse) yield { DynamicTest.dynamicTest( s"testHalfDuplex() - size1=$size1, size2=$size2", @@ -46,7 +46,7 @@ class PseudoAsyncTest extends StrictLogging { // test a full-duplex interaction, without any renegotiation @TestFactory def testFullDuplex(): util.Collection[DynamicTest] = { - val sizes = LazyList.iterate(1)(_ * 3).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) + val sizes = LazyList.iterate(1)(_ * 4).takeWhileInclusive(_ <= SslContextFactory.tlsMaxDataSize) val tests = for ((size1, size2) <- sizes zip sizes.reverse) yield { DynamicTest.dynamicTest( s"testFullDuplex() - size1=$size1, size2=$size2",