From 347cdb31458e874bd14c47f2db54a2e822329751 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 5 Jan 2024 01:06:05 +0900 Subject: [PATCH] speedup core tests (#21) --- .../src/test/kotlin/io/redpulsar/core/locks/RedLockTest.kt | 6 +++--- .../test/kotlin/io/redpulsar/core/locks/SemaphoreTest.kt | 2 +- .../test/kotlin/io/redpulsar/core/locks/SimpleLockTest.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/RedLockTest.kt b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/RedLockTest.kt index 73af0b8..4e34f02 100644 --- a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/RedLockTest.kt +++ b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/RedLockTest.kt @@ -50,7 +50,7 @@ class RedLockTest { every { backend.setLock(eq("test"), any(), any()) } returns null every { backend.removeLock(eq("test"), any()) } returns "OK" - val redLock = RedLock(listOf(backend)) + val redLock = RedLock(listOf(backend), retryDelay = 20.milliseconds, retryCount = 3) val permit = redLock.lock("test") assertFalse(permit) @@ -197,7 +197,7 @@ class RedLockTest { every { backend.removeLock(eq("test"), any()) } returns "OK" } - val redLock = RedLock(instances) + val redLock = RedLock(instances, retryDelay = 20.milliseconds, retryCount = 3) val permit = redLock.lock("test") assertFalse(permit) @@ -221,7 +221,7 @@ class RedLockTest { every { backend.removeLock(eq("test"), any()) } returns "OK" } - val redLock = RedLock(instances) + val redLock = RedLock(instances, retryDelay = 20.milliseconds, retryCount = 3) val permit = redLock.lock("test", 20.milliseconds) assertFalse(permit) diff --git a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SemaphoreTest.kt b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SemaphoreTest.kt index d273ab7..0cbc1b2 100644 --- a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SemaphoreTest.kt +++ b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SemaphoreTest.kt @@ -354,7 +354,7 @@ class SemaphoreTest { } returns "OK" } - val semaphore = Semaphore(instances, 3) + val semaphore = Semaphore(instances, 3, 20.milliseconds, 3) val permit = semaphore.lock("test") assertFalse(permit) diff --git a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SimpleLockTest.kt b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SimpleLockTest.kt index 9d2d3a5..cbefd5d 100644 --- a/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SimpleLockTest.kt +++ b/redpulsar-core/src/test/kotlin/io/redpulsar/core/locks/SimpleLockTest.kt @@ -45,7 +45,7 @@ class SimpleLockTest { // every { redis.set(eq("test"), any(), any()) } returns null every { backend.setLock(eq("test"), any(), any()) } returns null - val simpleLock = SimpleLock(backend) + val simpleLock = SimpleLock(backend, retryDelay = 20.milliseconds, retryCount = 3) val permit = simpleLock.lock("test", 1.seconds) assertFalse(permit)