Skip to content

Commit

Permalink
Make tests lighter
Browse files Browse the repository at this point in the history
  • Loading branch information
marianobarrios committed Jun 8, 2023
1 parent 9950891 commit 6bc8d0d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/test/scala/tlschannel/BlockingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/tlschannel/ConcurrentTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/tlschannel/NullEngineTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/tlschannel/NullMultiNonBlockingTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/tlschannel/async/AsyncCloseTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/tlschannel/async/AsyncQuickCloseTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/tlschannel/async/AsyncShutdownTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/tlschannel/async/AsyncTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/test/scala/tlschannel/async/AsyncTimeoutTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AsyncTimeoutTest extends AsyncTestBase {

val bufferSize = 10

val repetitions = 1000
val repetitions = 50

// scheduled timeout
@Test
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/tlschannel/async/PseudoAsyncTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 6bc8d0d

Please sign in to comment.