summaryrefslogtreecommitdiff
path: root/opendc-compute
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-compute')
-rw-r--r--opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt2
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt16
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/failure/HostFaultInjectorTest.kt6
3 files changed, 12 insertions, 12 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 c18709f3..b790d36f 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
@@ -62,7 +62,7 @@ internal class ComputeServiceTest {
@BeforeEach
fun setUp() {
scope = SimulationCoroutineScope()
- val clock = scope.clock
+ val clock = scope.timeSource
val computeScheduler = FilterScheduler(
filters = listOf(ComputeFilter(), VCpuFilter(allocationRatio = 1.0), RamFilter(allocationRatio = 1.0)),
weighers = listOf(RamWeigher())
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 fc581d3e..ac97552f 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
@@ -75,7 +75,7 @@ internal class SimHostTest {
fun testSingle() = runSimulation {
val duration = 5 * 60L
- val engine = FlowEngine.create(coroutineContext, clock)
+ val engine = FlowEngine.create(coroutineContext, timeSource)
val graph = engine.newGraph()
val machine = SimBareMetalMachine.create(graph, machineModel)
@@ -85,7 +85,7 @@ internal class SimHostTest {
uid = UUID.randomUUID(),
name = "test",
meta = emptyMap(),
- clock,
+ timeSource,
machine,
hypervisor
)
@@ -131,7 +131,7 @@ internal class SimHostTest {
{ assertEquals(639, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2360, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(56, cpuStats.stealTime, "Steal time does not match") },
- { assertEquals(1500001, clock.millis()) }
+ { assertEquals(1500001, timeSource.millis()) }
)
}
@@ -142,7 +142,7 @@ internal class SimHostTest {
fun testOvercommitted() = runSimulation {
val duration = 5 * 60L
- val engine = FlowEngine.create(coroutineContext, clock)
+ val engine = FlowEngine.create(coroutineContext, timeSource)
val graph = engine.newGraph()
val machine = SimBareMetalMachine.create(graph, machineModel)
@@ -152,7 +152,7 @@ internal class SimHostTest {
uid = UUID.randomUUID(),
name = "test",
meta = emptyMap(),
- clock,
+ timeSource,
machine,
hypervisor
)
@@ -218,7 +218,7 @@ internal class SimHostTest {
{ assertEquals(658, cpuStats.activeTime, "Active time does not match") },
{ assertEquals(2341, cpuStats.idleTime, "Idle time does not match") },
{ assertEquals(637, cpuStats.stealTime, "Steal time does not match") },
- { assertEquals(1500001, clock.millis()) }
+ { assertEquals(1500001, timeSource.millis()) }
)
}
@@ -229,7 +229,7 @@ internal class SimHostTest {
fun testFailure() = runSimulation {
val duration = 5 * 60L
- val engine = FlowEngine.create(coroutineContext, clock)
+ val engine = FlowEngine.create(coroutineContext, timeSource)
val graph = engine.newGraph()
val machine = SimBareMetalMachine.create(graph, machineModel)
@@ -238,7 +238,7 @@ internal class SimHostTest {
uid = UUID.randomUUID(),
name = "test",
meta = emptyMap(),
- clock,
+ timeSource,
machine,
hypervisor
)
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 54a5d1c8..29d0b5e7 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
@@ -46,7 +46,7 @@ class HostFaultInjectorTest {
fun testInjectorNotStarted() = runSimulation {
val host = mockk<SimHost>(relaxUnitFun = true)
- val injector = createSimpleInjector(coroutineContext, clock, setOf(host))
+ val injector = createSimpleInjector(coroutineContext, timeSource, setOf(host))
coVerify(exactly = 0) { host.fail() }
coVerify(exactly = 0) { host.recover() }
@@ -61,7 +61,7 @@ class HostFaultInjectorTest {
fun testInjectorStopsMachine() = runSimulation {
val host = mockk<SimHost>(relaxUnitFun = true)
- val injector = createSimpleInjector(coroutineContext, clock, setOf(host))
+ val injector = createSimpleInjector(coroutineContext, timeSource, setOf(host))
injector.start()
@@ -83,7 +83,7 @@ class HostFaultInjectorTest {
mockk(relaxUnitFun = true)
)
- val injector = createSimpleInjector(coroutineContext, clock, hosts.toSet())
+ val injector = createSimpleInjector(coroutineContext, timeSource, hosts.toSet())
injector.start()