summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-service/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-04 14:41:39 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-04 14:41:39 +0200
commit4883d8eb0c6cae82153aaf5f12561014d08cdc41 (patch)
treed4fdc0f3688209703fddaae529a30cd89a7bf17c /opendc-compute/opendc-compute-service/src/test
parent67920d2e83658b92a39e25956999c2ed61738ade (diff)
feat(compute): Add support for looking up hosts
This change adds the ability for users to lookup the `Host` on which a `Server` is hosted (if any). This allows the user to potentially interact with the `Host` directly, e.g., in order to obtain advanced metrics.
Diffstat (limited to 'opendc-compute/opendc-compute-service/src/test')
-rw-r--r--opendc-compute/opendc-compute-service/src/test/kotlin/org/opendc/compute/service/ComputeServiceTest.kt9
1 files changed, 2 insertions, 7 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 7b8d0fe2..eb106817 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
@@ -24,7 +24,6 @@ package org.opendc.compute.service
import io.mockk.*
import io.opentelemetry.api.metrics.MeterProvider
-import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNull
@@ -48,10 +47,9 @@ import java.util.*
/**
* Test suite for the [ComputeService] interface.
*/
-@OptIn(ExperimentalCoroutinesApi::class)
internal class ComputeServiceTest {
- lateinit var scope: SimulationCoroutineScope
- lateinit var service: ComputeService
+ private lateinit var scope: SimulationCoroutineScope
+ private lateinit var service: ComputeService
@BeforeEach
fun setUp() {
@@ -128,14 +126,12 @@ internal class ComputeServiceTest {
every { host.model } returns HostModel(4 * 2600.0, 4, 2048)
every { host.state } returns HostState.UP
- assertEquals(0, service.hostCount)
assertEquals(emptySet<Host>(), service.hosts)
service.addHost(host)
verify(exactly = 1) { host.addListener(any()) }
- assertEquals(1, service.hostCount)
assertEquals(1, service.hosts.size)
service.removeHost(host)
@@ -150,7 +146,6 @@ internal class ComputeServiceTest {
every { host.model } returns HostModel(4 * 2600.0, 4, 2048)
every { host.state } returns HostState.DOWN
- assertEquals(0, service.hostCount)
assertEquals(emptySet<Host>(), service.hosts)
service.addHost(host)