Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
tryangul committed Nov 20, 2024
1 parent 18508a9 commit a1af53d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ class ReservationManagerTest {
Assertions.assertTrue(reserved.get())
}

// @Test
// fun testReserveMultithreaded() = runTest {
// val manager = ReservationManager(1000)
// withContext(Dispatchers.IO) {
// manager.reserve(1000, this)
// Assertions.assertEquals(0, manager.remainingCapacityBytes)
// val nIterations = 100000
//
// val jobs = (0 until nIterations).map { launch { manager.reserve(10, this) } }
//
// repeat(nIterations) {
// manager.release(10)
// Assertions.assertTrue(
// manager.remainingCapacityBytes >= 0,
// "Remaining memory is negative: ${manager.remainingCapacityBytes}"
// )
// }
// jobs.forEach { it.join() }
// Assertions.assertEquals(0, manager.remainingCapacityBytes)
// }
// }
@Test
fun testReserveMultithreaded() = runTest {
val manager = ReservationManager(1000)
withContext(Dispatchers.IO) {
manager.reserve(1000, this)
Assertions.assertEquals(0, manager.remainingCapacityBytes)
val nIterations = 100000

val jobs = (0 until nIterations).map { launch { manager.reserve(10, this) } }

repeat(nIterations) {
manager.release(10)
Assertions.assertTrue(
manager.remainingCapacityBytes >= 0,
"Remaining memory is negative: ${manager.remainingCapacityBytes}"
)
}
jobs.forEach { it.join() }
Assertions.assertEquals(0, manager.remainingCapacityBytes)
}
}

@Test
fun testRequestingMoreThanAvailableThrows() = runTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ class SpillToDiskTaskTest {
@Test
fun `publishes 'spilled file' aggregates according to time window on stream flush event`() =
runTest {

val timeWindow = TimeWindowTrigger(Clock.systemUTC(), 0)
task =
val task =
DefaultSpillToDiskTask(
spillFileProvider,
inputQueue,
Expand Down Expand Up @@ -141,7 +140,6 @@ class SpillToDiskTaskTest {
task.execute()
coVerify(exactly = 1) { taskLauncher.handleNewSpilledFile(any(), any()) }
}

}

/**
Expand Down

0 comments on commit a1af53d

Please sign in to comment.