summaryrefslogtreecommitdiff
path: root/opendc-workflow/opendc-workflow-service/src/test/kotlin/org
diff options
context:
space:
mode:
authorDante Niewenhuis <d.niewenhuis@hotmail.com>2024-03-05 13:23:57 +0100
committerGitHub <noreply@github.com>2024-03-05 13:23:57 +0100
commit5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec (patch)
tree5b2773b8dc21c2e1b526fb70f829c376dd80532a /opendc-workflow/opendc-workflow-service/src/test/kotlin/org
parentd28002a3c151d198298574312f32f1cb43f3a660 (diff)
Updated package versions, updated web server tests. (#207)
* Updated all package versions including kotlin. Updated all web-server tests to run. * Changed the java version of the tests. OpenDC now only supports java 19. * small update * test update * new update * updated docker version to 19 * updated docker version to 19
Diffstat (limited to 'opendc-workflow/opendc-workflow-service/src/test/kotlin/org')
-rw-r--r--opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt101
1 files changed, 51 insertions, 50 deletions
diff --git a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt
index 68f2e610..1d87417d 100644
--- a/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt
+++ b/opendc-workflow/opendc-workflow-service/src/test/kotlin/org/opendc/workflow/service/WorkflowServiceTest.kt
@@ -66,63 +66,64 @@ internal class WorkflowServiceTest {
* A large integration test where we check whether all tasks in some trace are executed correctly.
*/
@Test
- fun testTrace() = runSimulation {
- val computeService = "compute.opendc.org"
- val workflowService = "workflow.opendc.org"
+ fun testTrace() =
+ runSimulation {
+ val computeService = "compute.opendc.org"
+ val workflowService = "workflow.opendc.org"
- Provisioner(dispatcher, seed = 0L).use { provisioner ->
- val scheduler: (ProvisioningContext) -> ComputeScheduler = {
- FilterScheduler(
- filters = listOf(ComputeFilter(), VCpuFilter(1.0), RamFilter(1.0)),
- weighers = listOf(VCpuWeigher(1.0, multiplier = 1.0))
- )
- }
-
- provisioner.runSteps(
- // Configure the ComputeService that is responsible for mapping virtual machines onto physical hosts
- setupComputeService(computeService, scheduler, schedulingQuantum = Duration.ofSeconds(1)),
- setupHosts(computeService, List(4) { createHostSpec(it) }),
-
- // Configure the WorkflowService that is responsible for scheduling the workflow tasks onto machines
- setupWorkflowService(
- workflowService,
- computeService,
- WorkflowSchedulerSpec(
- schedulingQuantum = Duration.ofMillis(100),
- jobAdmissionPolicy = NullJobAdmissionPolicy,
- jobOrderPolicy = SubmissionTimeJobOrderPolicy(),
- taskEligibilityPolicy = NullTaskEligibilityPolicy,
- taskOrderPolicy = SubmissionTimeTaskOrderPolicy()
+ Provisioner(dispatcher, seed = 0L).use { provisioner ->
+ val scheduler: (ProvisioningContext) -> ComputeScheduler = {
+ FilterScheduler(
+ filters = listOf(ComputeFilter(), VCpuFilter(1.0), RamFilter(1.0)),
+ weighers = listOf(VCpuWeigher(1.0, multiplier = 1.0)),
)
+ }
+
+ provisioner.runSteps(
+ // Configure the ComputeService that is responsible for mapping virtual machines onto physical hosts
+ setupComputeService(computeService, scheduler, schedulingQuantum = Duration.ofSeconds(1)),
+ setupHosts(computeService, List(4) { createHostSpec(it) }),
+ // Configure the WorkflowService that is responsible for scheduling the workflow tasks onto machines
+ setupWorkflowService(
+ workflowService,
+ computeService,
+ WorkflowSchedulerSpec(
+ schedulingQuantum = Duration.ofMillis(100),
+ jobAdmissionPolicy = NullJobAdmissionPolicy,
+ jobOrderPolicy = SubmissionTimeJobOrderPolicy(),
+ taskEligibilityPolicy = NullTaskEligibilityPolicy,
+ taskOrderPolicy = SubmissionTimeTaskOrderPolicy(),
+ ),
+ ),
)
- )
- val service = provisioner.registry.resolve(workflowService, WorkflowService::class.java)!!
+ val service = provisioner.registry.resolve(workflowService, WorkflowService::class.java)!!
- val trace = Trace.open(
- Paths.get(checkNotNull(WorkflowServiceTest::class.java.getResource("/trace.gwf")).toURI()),
- format = "gwf"
- )
- service.replay(timeSource, trace.toJobs())
+ val trace =
+ Trace.open(
+ Paths.get(checkNotNull(WorkflowServiceTest::class.java.getResource("/trace.gwf")).toURI()),
+ format = "gwf",
+ )
+ service.replay(timeSource, trace.toJobs())
- val metrics = service.getSchedulerStats()
+ val metrics = service.getSchedulerStats()
- assertAll(
- { assertEquals(758, metrics.workflowsSubmitted, "No jobs submitted") },
- { assertEquals(0, metrics.workflowsRunning, "Not all submitted jobs started") },
- {
- assertEquals(
- metrics.workflowsSubmitted,
- metrics.workflowsFinished,
- "Not all started jobs finished"
- )
- },
- { assertEquals(0, metrics.tasksRunning, "Not all started tasks finished") },
- { assertEquals(metrics.tasksSubmitted, metrics.tasksFinished, "Not all started tasks finished") },
- { assertEquals(45975707L, timeSource.millis()) { "Total duration incorrect" } }
- )
+ assertAll(
+ { assertEquals(758, metrics.workflowsSubmitted, "No jobs submitted") },
+ { assertEquals(0, metrics.workflowsRunning, "Not all submitted jobs started") },
+ {
+ assertEquals(
+ metrics.workflowsSubmitted,
+ metrics.workflowsFinished,
+ "Not all started jobs finished",
+ )
+ },
+ { assertEquals(0, metrics.tasksRunning, "Not all started tasks finished") },
+ { assertEquals(metrics.tasksSubmitted, metrics.tasksFinished, "Not all started tasks finished") },
+ { assertEquals(45975707L, timeSource.millis()) { "Total duration incorrect" } },
+ )
+ }
}
- }
/**
* Construct a [HostSpec] for a simulated host.
@@ -141,7 +142,7 @@ internal class WorkflowServiceTest {
emptyMap(),
machineModel,
SimPsuFactories.noop(),
- FlowMultiplexerFactory.forwardingMultiplexer()
+ FlowMultiplexerFactory.forwardingMultiplexer(),
)
}
}