summaryrefslogtreecommitdiff
path: root/simulator/opendc-experiments/opendc-experiments-capelin/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-25 14:33:56 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-26 15:40:26 +0100
commit0c5f0a07f87f85119be83b923ffe60b3863ebb9d (patch)
treea516b704b4c56889153201a5481b6fb6534da8f0 /simulator/opendc-experiments/opendc-experiments-capelin/src/test
parent0bbb0adb97ba4783bbd0073f845781725e6212e8 (diff)
compute: Hide internals of compute service implementation
This change changes the compute service and users of the compute service to not rely on the internals of `ComputeServiceImpl` and instead use its public API.
Diffstat (limited to 'simulator/opendc-experiments/opendc-experiments-capelin/src/test')
-rw-r--r--simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt19
1 files changed, 9 insertions, 10 deletions
diff --git a/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt b/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
index a812490a..c16f7003 100644
--- a/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
+++ b/simulator/opendc-experiments/opendc-experiments-capelin/src/test/kotlin/org/opendc/experiments/capelin/CapelinIntegrationTest.kt
@@ -33,8 +33,8 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertAll
+import org.opendc.compute.service.ComputeService
import org.opendc.compute.service.driver.Host
-import org.opendc.compute.service.internal.ComputeServiceImpl
import org.opendc.compute.service.scheduler.AvailableCoreMemoryAllocationPolicy
import org.opendc.experiments.capelin.model.Workload
import org.opendc.experiments.capelin.monitor.ExperimentMonitor
@@ -94,7 +94,8 @@ class CapelinIntegrationTest {
val allocationPolicy = AvailableCoreMemoryAllocationPolicy()
val traceReader = createTestTraceReader()
val environmentReader = createTestEnvironmentReader()
- lateinit var scheduler: ComputeServiceImpl
+ lateinit var scheduler: ComputeService
+ lateinit var monitorResults: MonitorResults
val tracer = EventTracer(clock)
testScope.launch {
@@ -120,9 +121,8 @@ class CapelinIntegrationTest {
null
}
- attachMonitor(this, clock, scheduler, monitor)
+ monitorResults = attachMonitor(this, clock, scheduler, monitor)
processTrace(
- this,
clock,
traceReader,
scheduler,
@@ -130,7 +130,7 @@ class CapelinIntegrationTest {
monitor
)
- println("Finish SUBMIT=${scheduler.submittedVms} FAIL=${scheduler.unscheduledVms} QUEUE=${scheduler.queuedVms} RUNNING=${scheduler.runningVms} FINISH=${scheduler.finishedVms}")
+ println("Finish SUBMIT=${monitorResults.submittedVms} FAIL=${monitorResults.unscheduledVms} QUEUE=${monitorResults.queuedVms} RUNNING=${monitorResults.runningVms} FINISH=${monitorResults.finishedVms}")
failureDomain?.cancel()
scheduler.close()
@@ -141,8 +141,8 @@ class CapelinIntegrationTest {
// Note that these values have been verified beforehand
assertAll(
- { assertEquals(50, scheduler.submittedVms, "The trace contains 50 VMs") },
- { assertEquals(50, scheduler.finishedVms, "All VMs should finish after a run") },
+ { assertEquals(50, monitorResults.submittedVms, "The trace contains 50 VMs") },
+ { assertEquals(50, monitorResults.finishedVms, "All VMs should finish after a run") },
{ assertEquals(1672916917970, monitor.totalRequestedBurst) { "Incorrect requested burst" } },
{ assertEquals(435179794565, monitor.totalGrantedBurst) { "Incorrect granted burst" } },
{ assertEquals(1236692477983, monitor.totalOvercommissionedBurst) { "Incorrect overcommitted burst" } },
@@ -167,9 +167,8 @@ class CapelinIntegrationTest {
allocationPolicy,
tracer
)
- attachMonitor(this, clock, scheduler, monitor)
+ val monitorResults = attachMonitor(this, clock, scheduler, monitor)
processTrace(
- this,
clock,
traceReader,
scheduler,
@@ -179,7 +178,7 @@ class CapelinIntegrationTest {
yield()
- println("Finish SUBMIT=${scheduler.submittedVms} FAIL=${scheduler.unscheduledVms} QUEUE=${scheduler.queuedVms} RUNNING=${scheduler.runningVms} FINISH=${scheduler.finishedVms}")
+ println("Finish SUBMIT=${monitorResults.submittedVms} FAIL=${monitorResults.unscheduledVms} QUEUE=${monitorResults.queuedVms} RUNNING=${monitorResults.runningVms} FINISH=${monitorResults.finishedVms}")
scheduler.close()
monitor.close()