summaryrefslogtreecommitdiff
path: root/opendc-compute
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:10:11 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-10-05 14:10:11 +0200
commitbe176910eb870209576326ffaad8bf21241fccbd (patch)
tree3903d8aed5e87850c92e1b2dce8379ea99bdfa6d /opendc-compute
parentc214a7fe0d46ecc23a71f9237b20281c0ca1c929 (diff)
refactor(sim/core): Rename runBlockingSimulation to runSimulation
This change renames the method `runBlockingSimulation` to `runSimulation` to put more emphasis on the simulation part of the method. The blocking part is not that important, but this behavior is still described in the method documentation.
Diffstat (limited to 'opendc-compute')
-rw-r--r--opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt32
-rw-r--r--opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt26
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt6
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt8
4 files changed, 36 insertions, 36 deletions
diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt
index 6c251516..4f4008bc 100644
--- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt
+++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt
@@ -40,7 +40,7 @@ import org.opendc.compute.service.scheduler.filters.RamFilter
import org.opendc.compute.service.scheduler.filters.VCpuFilter
import org.opendc.compute.service.scheduler.weights.RamWeigher
import org.opendc.simulator.kotlin.SimulationCoroutineScope
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -62,7 +62,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testClientClose() = scope.runBlockingSimulation {
+ fun testClientClose() = scope.runSimulation {
val client = service.newClient()
assertEquals(emptyList<Flavor>(), client.queryFlavors())
@@ -85,7 +85,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testClientCreate() = scope.runBlockingSimulation {
+ fun testClientCreate() = scope.runSimulation {
val client = service.newClient()
val flavor = client.newFlavor("test", 1, 1024)
@@ -111,7 +111,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testClientOnClose() = scope.runBlockingSimulation {
+ fun testClientOnClose() = scope.runSimulation {
service.close()
assertThrows<IllegalStateException> {
service.newClient()
@@ -119,7 +119,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testAddHost() = scope.runBlockingSimulation {
+ fun testAddHost() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
every { host.model } returns HostModel(4 * 2600.0, 4, 2048)
@@ -139,7 +139,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testAddHostDouble() = scope.runBlockingSimulation {
+ fun testAddHostDouble() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
every { host.model } returns HostModel(4 * 2600.0, 4, 2048)
@@ -154,7 +154,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerStartWithoutEnoughCpus() = scope.runBlockingSimulation {
+ fun testServerStartWithoutEnoughCpus() = scope.runSimulation {
val client = service.newClient()
val flavor = client.newFlavor("test", 1, 0)
val image = client.newImage("test")
@@ -167,7 +167,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerStartWithoutEnoughMemory() = scope.runBlockingSimulation {
+ fun testServerStartWithoutEnoughMemory() = scope.runSimulation {
val client = service.newClient()
val flavor = client.newFlavor("test", 0, 1024)
val image = client.newImage("test")
@@ -180,7 +180,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerStartWithoutEnoughResources() = scope.runBlockingSimulation {
+ fun testServerStartWithoutEnoughResources() = scope.runSimulation {
val client = service.newClient()
val flavor = client.newFlavor("test", 1, 1024)
val image = client.newImage("test")
@@ -193,7 +193,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerCancelRequest() = scope.runBlockingSimulation {
+ fun testServerCancelRequest() = scope.runSimulation {
val client = service.newClient()
val flavor = client.newFlavor("test", 1, 1024)
val image = client.newImage("test")
@@ -207,7 +207,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerCannotFitOnHost() = scope.runBlockingSimulation {
+ fun testServerCannotFitOnHost() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
every { host.model } returns HostModel(4 * 2600.0, 4, 2048)
@@ -230,7 +230,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testHostAvailableAfterSomeTime() = scope.runBlockingSimulation {
+ fun testHostAvailableAfterSomeTime() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
val listeners = mutableListOf<HostListener>()
@@ -261,7 +261,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testHostUnavailableAfterSomeTime() = scope.runBlockingSimulation {
+ fun testHostUnavailableAfterSomeTime() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
val listeners = mutableListOf<HostListener>()
@@ -292,7 +292,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerInvalidType() = scope.runBlockingSimulation {
+ fun testServerInvalidType() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
val listeners = mutableListOf<HostListener>()
@@ -315,7 +315,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerDeploy() = scope.runBlockingSimulation {
+ fun testServerDeploy() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
val listeners = mutableListOf<HostListener>()
@@ -358,7 +358,7 @@ internal class ComputeServiceTest {
}
@Test
- fun testServerDeployFailure() = scope.runBlockingSimulation {
+ fun testServerDeployFailure() = scope.runSimulation {
val host = mockk<Host>(relaxUnitFun = true)
val listeners = mutableListOf<HostListener>()
diff --git a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt
index 0d44722b..9e59949f 100644
--- a/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt
+++ b/opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/InternalServerTest.kt
@@ -34,7 +34,7 @@ import org.opendc.compute.service.internal.ComputeServiceImpl
import org.opendc.compute.service.internal.InternalFlavor
import org.opendc.compute.service.internal.InternalImage
import org.opendc.compute.service.internal.InternalServer
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.util.*
/**
@@ -94,7 +94,7 @@ class InternalServerTest {
}
@Test
- fun testStartTerminatedServer() = runBlockingSimulation {
+ fun testStartTerminatedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -110,7 +110,7 @@ class InternalServerTest {
}
@Test
- fun testStartDeletedServer() = runBlockingSimulation {
+ fun testStartDeletedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -123,7 +123,7 @@ class InternalServerTest {
}
@Test
- fun testStartProvisioningServer() = runBlockingSimulation {
+ fun testStartProvisioningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -138,7 +138,7 @@ class InternalServerTest {
}
@Test
- fun testStartRunningServer() = runBlockingSimulation {
+ fun testStartRunningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -153,7 +153,7 @@ class InternalServerTest {
}
@Test
- fun testStopProvisioningServer() = runBlockingSimulation {
+ fun testStopProvisioningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -171,7 +171,7 @@ class InternalServerTest {
}
@Test
- fun testStopTerminatedServer() = runBlockingSimulation {
+ fun testStopTerminatedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -185,7 +185,7 @@ class InternalServerTest {
}
@Test
- fun testStopDeletedServer() = runBlockingSimulation {
+ fun testStopDeletedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -199,7 +199,7 @@ class InternalServerTest {
}
@Test
- fun testStopRunningServer() = runBlockingSimulation {
+ fun testStopRunningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>()
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -216,7 +216,7 @@ class InternalServerTest {
}
@Test
- fun testDeleteProvisioningServer() = runBlockingSimulation {
+ fun testDeleteProvisioningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>(relaxUnitFun = true)
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -235,7 +235,7 @@ class InternalServerTest {
}
@Test
- fun testDeleteTerminatedServer() = runBlockingSimulation {
+ fun testDeleteTerminatedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>(relaxUnitFun = true)
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -251,7 +251,7 @@ class InternalServerTest {
}
@Test
- fun testDeleteDeletedServer() = runBlockingSimulation {
+ fun testDeleteDeletedServer() = runSimulation {
val service = mockk<ComputeServiceImpl>(relaxUnitFun = true)
val uid = UUID.randomUUID()
val flavor = mockFlavor()
@@ -265,7 +265,7 @@ class InternalServerTest {
}
@Test
- fun testDeleteRunningServer() = runBlockingSimulation {
+ fun testDeleteRunningServer() = runSimulation {
val service = mockk<ComputeServiceImpl>(relaxUnitFun = true)
val uid = UUID.randomUUID()
val flavor = mockFlavor()
diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
index 1634473e..f63d4c6f 100644
--- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
+++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
@@ -43,7 +43,7 @@ import org.opendc.simulator.compute.workload.SimTraceFragment
import org.opendc.simulator.compute.workload.SimTraceWorkload
import org.opendc.simulator.flow.FlowEngine
import org.opendc.simulator.flow.mux.FlowMultiplexerFactory
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.time.Instant
import java.util.*
import kotlin.coroutines.resume
@@ -68,7 +68,7 @@ internal class SimHostTest {
* Test overcommitting of resources by the hypervisor.
*/
@Test
- fun testOvercommitted() = runBlockingSimulation {
+ fun testOvercommitted() = runSimulation {
val duration = 5 * 60L
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
@@ -152,7 +152,7 @@ internal class SimHostTest {
* Test failure of the host.
*/
@Test
- fun testFailure() = runBlockingSimulation {
+ fun testFailure() = runSimulation {
val duration = 5 * 60L
val engine = FlowEngine(coroutineContext, clock)
val machine = SimBareMetalMachine(engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)))
diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt
index 5b71e716..90f534e6 100644
--- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt
+++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt
@@ -29,7 +29,7 @@ import org.apache.commons.math3.distribution.LogNormalDistribution
import org.apache.commons.math3.random.Well19937c
import org.junit.jupiter.api.Test
import org.opendc.compute.simulator.SimHost
-import org.opendc.simulator.kotlin.runBlockingSimulation
+import org.opendc.simulator.kotlin.runSimulation
import java.time.Clock
import java.time.Duration
import kotlin.coroutines.CoroutineContext
@@ -43,7 +43,7 @@ internal class HostFaultInjectorTest {
* Simple test case to test that nothing happens when the injector is not started.
*/
@Test
- fun testInjectorNotStarted() = runBlockingSimulation {
+ fun testInjectorNotStarted() = runSimulation {
val host = mockk<SimHost>(relaxUnitFun = true)
val injector = createSimpleInjector(coroutineContext, clock, setOf(host))
@@ -58,7 +58,7 @@ internal class HostFaultInjectorTest {
* Simple test case to test a start stop fault where the machine is stopped and started after some time.
*/
@Test
- fun testInjectorStopsMachine() = runBlockingSimulation {
+ fun testInjectorStopsMachine() = runSimulation {
val host = mockk<SimHost>(relaxUnitFun = true)
val injector = createSimpleInjector(coroutineContext, clock, setOf(host))
@@ -77,7 +77,7 @@ internal class HostFaultInjectorTest {
* Simple test case to test a start stop fault where multiple machines are stopped.
*/
@Test
- fun testInjectorStopsMultipleMachines() = runBlockingSimulation {
+ fun testInjectorStopsMultipleMachines() = runSimulation {
val hosts = listOf<SimHost>(
mockk(relaxUnitFun = true),
mockk(relaxUnitFun = true)