From c7e303ad1b5217e2ff24cee9538ac841d6149706 Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Tue, 20 May 2025 11:06:12 +0200 Subject: Fixed bug when not providing a Carbon Model (#339) --- .../experiments/base/ExperimentRunnerTest.kt | 46 ++++++++++++++++++++++ .../test/resources/experiments/experiment_1.json | 23 +++++++++++ .../test/resources/topologies/single_50_big.json | 28 +++++++++++++ .../resources/topologies/single_50_big_BE.json | 31 +++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentRunnerTest.kt create mode 100644 opendc-experiments/opendc-experiments-base/src/test/resources/experiments/experiment_1.json create mode 100644 opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big.json create mode 100644 opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big_BE.json (limited to 'opendc-experiments/opendc-experiments-base/src/test') diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentRunnerTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentRunnerTest.kt new file mode 100644 index 00000000..6365f60d --- /dev/null +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentRunnerTest.kt @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020 AtLarge Research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package org.opendc.experiments.base + +import org.junit.jupiter.api.Test +import org.opendc.experiments.base.runner.ExperimentCommand +import java.io.File + +/** + * An integration test suite for the Experiment Runner. + */ +class ExperimentRunnerTest { + /** + * ExperimentRunner test 1 + * This test runs the experiment defined in the experiment_1.json file. + * + * In this test, the bitbrains-small workload is executed with and without a carbon trace. + */ + @Test + fun testExperimentRunner1() { + ExperimentCommand().main(arrayOf("--experiment-path", "src/test/resources/experiments/experiment_1.json")) + + val someDir = File("output") + someDir.deleteRecursively() + } +} diff --git a/opendc-experiments/opendc-experiments-base/src/test/resources/experiments/experiment_1.json b/opendc-experiments/opendc-experiments-base/src/test/resources/experiments/experiment_1.json new file mode 100644 index 00000000..48ae75ce --- /dev/null +++ b/opendc-experiments/opendc-experiments-base/src/test/resources/experiments/experiment_1.json @@ -0,0 +1,23 @@ +{ + "topologies": [ + {"pathToFile": "src/test/resources/topologies/single_50_big.json"}, + {"pathToFile": "src/test/resources/topologies/single_50_big_BE.json"} + ], + "workloads": [{ + "pathToFile": "src/test/resources/workloadTraces/bitbrains-small", + "type": "ComputeWorkload", + "submissionTime": "2024-03-01T00:00:00" + }], + "allocationPolicies": [ + { + "type": "prefab", + "policyName": "Mem" + } + ], + "exportModels": [ + { + "exportInterval": 3600, + "printFrequency": 24 + } + ] +} diff --git a/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big.json b/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big.json new file mode 100644 index 00000000..676d4f3d --- /dev/null +++ b/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big.json @@ -0,0 +1,28 @@ +{ + "clusters": + [ + { + "name": "C01", + "hosts" : + [ + { + "name": "H01", + "cpu": + { + "coreCount": 64, + "coreSpeed": 2000 + }, + "memory": { + "memorySize": 140457600000 + }, + "powerModel": { + "modelType": "linear", + "power": 400.0, + "idlePower": 100.0, + "maxPower": 200.0 + } + } + ] + } + ] +} diff --git a/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big_BE.json b/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big_BE.json new file mode 100644 index 00000000..d2c19861 --- /dev/null +++ b/opendc-experiments/opendc-experiments-base/src/test/resources/topologies/single_50_big_BE.json @@ -0,0 +1,31 @@ +{ + "clusters": + [ + { + "name": "C01", + "hosts" : + [ + { + "name": "H01", + "cpu": + { + "coreCount": 64, + "coreSpeed": 2000 + }, + "memory": { + "memorySize": 140457600000 + }, + "powerModel": { + "modelType": "linear", + "power": 400.0, + "idlePower": 100.0, + "maxPower": 200.0 + } + } + ], + "powerSource": { + "carbonTracePath": "src/test/resources/carbonTraces/2022-01-01_2022-12-31_BE.parquet" + } + } + ] +} -- cgit v1.2.3