Skip to content

Commit

Permalink
make test more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed May 24, 2024
1 parent 11b0c58 commit 547fb6f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sample/test/klite/jdbc/JdbcExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import klite.sample.TempTableDBTest
import klite.toValues
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test
import java.math.BigDecimal
Expand Down Expand Up @@ -95,9 +94,11 @@ open class JdbcExtensionsTest: TempTableDBTest() {
@Test fun `postgres notify and listen`() = runTest {
val channel = Channel<String>(UNLIMITED)
val reader = thread {
db.consumeNotifications(setOf("hello"), 100.milliseconds) { channel.trySend(it.parameter) }
db.consumeNotifications(setOf("hello"), 500.milliseconds) {
channel.trySend(it.parameter)
}
}
delay(100)
Thread.sleep(100)
db.notify("hello")
db.notify("hello", "world")
Transaction.current()!!.commit()
Expand Down

0 comments on commit 547fb6f

Please sign in to comment.