summaryrefslogtreecommitdiff
path: root/simulator/opendc-compute/opendc-compute-simulator/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-07 15:44:36 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-07 16:13:16 +0100
commit9bb91897404bbeac1d5f7a7f890abd3a9d5d9084 (patch)
tree9e492df044306b6230444b73f2c3db59ef45440e /simulator/opendc-compute/opendc-compute-simulator/src/test
parentdfbca195cbe1d6c4eebe7ccd4cc707c84ac43e79 (diff)
compute: Move ComputeService implementation in service module
This change introduces the ComputeService interface (previously VirtProvisioningService) and provides a central implementation in opendc-compute-service. Previously, the implementation of this interface was bound to the simulator package, which meant that independent business logic could not be re-used without importing the simulator code.
Diffstat (limited to 'simulator/opendc-compute/opendc-compute-simulator/src/test')
-rw-r--r--simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
index 7b654473..d3b6c4bc 100644
--- a/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
+++ b/simulator/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
@@ -24,6 +24,7 @@ package org.opendc.compute.simulator
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
+import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
@@ -37,7 +38,9 @@ import org.opendc.compute.api.Image
import org.opendc.compute.api.Server
import org.opendc.compute.api.ServerState
import org.opendc.compute.api.ServerWatcher
-import org.opendc.compute.core.virt.HostEvent
+import org.opendc.compute.core.metal.Node
+import org.opendc.compute.core.metal.NodeState
+import org.opendc.compute.service.driver.HostEvent
import org.opendc.simulator.compute.SimFairShareHypervisorProvider
import org.opendc.simulator.compute.SimMachineModel
import org.opendc.simulator.compute.model.MemoryUnit
@@ -79,8 +82,13 @@ internal class SimHostTest {
var grantedWork = 0L
var overcommittedWork = 0L
+ val node = Node(
+ UUID.randomUUID(), "name", emptyMap(), NodeState.SHUTOFF,
+ Flavor(machineModel.cpus.size, machineModel.memory.map { it.size }.sum()), Image.EMPTY, emptyFlow()
+ )
+
scope.launch {
- val virtDriver = SimHost(UUID.randomUUID(), this, SimFairShareHypervisorProvider())
+ val virtDriver = SimHost(node, this, SimFairShareHypervisorProvider())
val vmm = Image(UUID.randomUUID(), "vmm", mapOf("workload" to virtDriver))
val duration = 5 * 60L
val vmImageA = Image(