summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-flow/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src/test')
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt8
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt28
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt22
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt10
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt8
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt6
6 files changed, 41 insertions, 41 deletions
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
index 220b247f..d782d036 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt
@@ -26,14 +26,14 @@ import io.mockk.*
import org.junit.jupiter.api.*
import org.opendc.simulator.flow.internal.FlowConsumerContextImpl
import org.opendc.simulator.flow.internal.FlowEngineImpl
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowConsumerContextImpl] class.
*/
class FlowConsumerContextTest {
@Test
- fun testFlushWithoutCommand() = runBlockingSimulation {
+ fun testFlushWithoutCommand() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
@@ -54,7 +54,7 @@ class FlowConsumerContextTest {
}
@Test
- fun testDoubleStart() = runBlockingSimulation {
+ fun testDoubleStart() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
@@ -79,7 +79,7 @@ class FlowConsumerContextTest {
}
@Test
- fun testIdempotentCapacityChange() = runBlockingSimulation {
+ fun testIdempotentCapacityChange() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val consumer = spyk(object : FlowSource {
override fun onPull(conn: FlowConnection, now: Long): Long {
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
index cd183ae2..2025dd52 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt
@@ -30,14 +30,14 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowForwarder] class.
*/
internal class FlowForwarderTest {
@Test
- fun testCancelImmediately() = runBlockingSimulation {
+ fun testCancelImmediately() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -56,7 +56,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancel() = runBlockingSimulation {
+ fun testCancel() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -83,7 +83,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testState() = runBlockingSimulation {
+ fun testState() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val consumer = object : FlowSource {
@@ -108,7 +108,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelPendingDelegate() = runBlockingSimulation {
+ fun testCancelPendingDelegate() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
@@ -126,7 +126,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelStartedDelegate() = runBlockingSimulation {
+ fun testCancelStartedDelegate() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -144,7 +144,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCancelPropagation() = runBlockingSimulation {
+ fun testCancelPropagation() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -162,7 +162,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testExitPropagation() = runBlockingSimulation {
+ fun testExitPropagation() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -183,7 +183,7 @@ internal class FlowForwarderTest {
@Test
@Disabled // Due to Kotlin bug: https://github.com/mockk/mockk/issues/368
- fun testAdjustCapacity() = runBlockingSimulation {
+ fun testAdjustCapacity() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val sink = FlowSink(engine, 1.0)
@@ -202,7 +202,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCounters() = runBlockingSimulation {
+ fun testCounters() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 1.0)
@@ -224,7 +224,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testCoupledExit() = runBlockingSimulation {
+ fun testCoupledExit() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -239,7 +239,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testPullFailureCoupled() = runBlockingSimulation {
+ fun testPullFailureCoupled() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine, isCoupled = true)
val source = FlowSink(engine, 2000.0)
@@ -262,7 +262,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testStartFailure() = runBlockingSimulation {
+ fun testStartFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
@@ -290,7 +290,7 @@ internal class FlowForwarderTest {
}
@Test
- fun testConvergeFailure() = runBlockingSimulation {
+ fun testConvergeFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val forwarder = FlowForwarder(engine)
val source = FlowSink(engine, 2000.0)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
index 95cb8123..22a84edb 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt
@@ -30,14 +30,14 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.FlowSourceRateAdapter
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FlowSink] class.
*/
internal class FlowSinkTest {
@Test
- fun testSpeed() = runBlockingSimulation {
+ fun testSpeed() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -53,7 +53,7 @@ internal class FlowSinkTest {
}
@Test
- fun testAdjustCapacity() = runBlockingSimulation {
+ fun testAdjustCapacity() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(engine, 1.0)
@@ -69,7 +69,7 @@ internal class FlowSinkTest {
}
@Test
- fun testSpeedLimit() = runBlockingSimulation {
+ fun testSpeedLimit() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -89,7 +89,7 @@ internal class FlowSinkTest {
* [FlowSource.onPull].
*/
@Test
- fun testIntermediateInterrupt() = runBlockingSimulation {
+ fun testIntermediateInterrupt() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -109,7 +109,7 @@ internal class FlowSinkTest {
}
@Test
- fun testInterrupt() = runBlockingSimulation {
+ fun testInterrupt() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -144,7 +144,7 @@ internal class FlowSinkTest {
}
@Test
- fun testFailure() = runBlockingSimulation {
+ fun testFailure() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -165,7 +165,7 @@ internal class FlowSinkTest {
}
@Test
- fun testExceptionPropagationOnNext() = runBlockingSimulation {
+ fun testExceptionPropagationOnNext() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -190,7 +190,7 @@ internal class FlowSinkTest {
}
@Test
- fun testConcurrentConsumption() = runBlockingSimulation {
+ fun testConcurrentConsumption() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -206,7 +206,7 @@ internal class FlowSinkTest {
}
@Test
- fun testCancelDuringConsumption() = runBlockingSimulation {
+ fun testCancelDuringConsumption() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
@@ -225,7 +225,7 @@ internal class FlowSinkTest {
@Test
fun testInfiniteSleep() {
assertThrows<IllegalStateException> {
- runBlockingSimulation {
+ runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val capacity = 4200.0
val provider = FlowSink(engine, capacity)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
index 523dac3a..cfd2bdf0 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt
@@ -32,7 +32,7 @@ import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.FlowSourceRateAdapter
import org.opendc.simulator.flow.source.TraceFlowSource
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* Test suite for the [ForwardingFlowMultiplexer] class.
@@ -42,7 +42,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test a trace workload.
*/
@Test
- fun testTrace() = runBlockingSimulation {
+ fun testTrace() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val speed = mutableListOf<Double>()
@@ -79,7 +79,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test runtime workload on hypervisor.
*/
@Test
- fun testRuntimeWorkload() = runBlockingSimulation {
+ fun testRuntimeWorkload() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L * 1000
@@ -101,7 +101,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test two workloads running sequentially.
*/
@Test
- fun testTwoWorkloads() = runBlockingSimulation {
+ fun testTwoWorkloads() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L * 1000
@@ -140,7 +140,7 @@ internal class ForwardingFlowMultiplexerTest {
* Test concurrent workloads on the machine.
*/
@Test
- fun testConcurrentWorkloadFails() = runBlockingSimulation {
+ fun testConcurrentWorkloadFails() = runSimulation {
val engine = FlowEngineImpl(coroutineContext, clock)
val switch = ForwardingFlowMultiplexer(engine)
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
index adfc265a..4e242292 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt
@@ -32,14 +32,14 @@ import org.opendc.simulator.flow.consume
import org.opendc.simulator.flow.internal.FlowEngineImpl
import org.opendc.simulator.flow.source.FixedFlowSource
import org.opendc.simulator.flow.source.TraceFlowSource
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* Test suite for the [FlowMultiplexer] implementations
*/
internal class MaxMinFlowMultiplexerTest {
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val switch = MaxMinFlowMultiplexer(scheduler)
@@ -61,7 +61,7 @@ internal class MaxMinFlowMultiplexerTest {
* Test overcommitting of resources via the hypervisor with a single VM.
*/
@Test
- fun testOvercommittedSingle() = runBlockingSimulation {
+ fun testOvercommittedSingle() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L
@@ -99,7 +99,7 @@ internal class MaxMinFlowMultiplexerTest {
* Test overcommitting of resources via the hypervisor with two VMs.
*/
@Test
- fun testOvercommittedDual() = runBlockingSimulation {
+ fun testOvercommittedDual() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val duration = 5 * 60L
diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
index 99630d32..552579ff 100644
--- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
+++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/source/FixedFlowSourceTest.kt
@@ -27,14 +27,14 @@ import org.junit.jupiter.api.Test
import org.opendc.simulator.flow.FlowSink
import org.opendc.simulator.flow.consume
import org.opendc.simulator.flow.internal.FlowEngineImpl
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
/**
* A test suite for the [FixedFlowSource] class.
*/
internal class FixedFlowSourceTest {
@Test
- fun testSmoke() = runBlockingSimulation {
+ fun testSmoke() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(scheduler, 1.0)
@@ -45,7 +45,7 @@ internal class FixedFlowSourceTest {
}
@Test
- fun testUtilization() = runBlockingSimulation {
+ fun testUtilization() = runSimulation {
val scheduler = FlowEngineImpl(coroutineContext, clock)
val provider = FlowSink(scheduler, 1.0)