From 1b525c98de4ac0f58ca7207cf654404228ab13b6 Mon Sep 17 00:00:00 2001 From: Marcel Becker <stu117960@mail.uni-kiel.de> Date: Thu, 17 Mar 2022 13:44:16 +0100 Subject: [PATCH] Splitted KubernetesExecutionRunner, added BenchmarkDeploymentBuilder and adjusted test structure --- .../rocks/theodolite/kubernetes/Shutdown.kt | 6 +-- ...hmark.kt => BenchmarkDeploymentBuilder.kt} | 16 ++----- .../KubernetesBenchmarkDeployment.kt | 2 + .../KubernetesBenchmarkDeploymentBuilder.kt} | 48 +++---------------- .../execution/ExperimentRunnerImpl.kt | 8 ++-- .../execution/TheodoliteExecutor.kt | 39 +++++++++++---- .../operator/BenchmarkStateChecker.kt | 16 ++----- .../operator/TheodoliteController.kt | 18 ++----- .../kubernetes/resourceSet/ResourceSets.kt | 20 +++++--- .../standalone/TheodoliteStandalone.kt | 3 +- .../theodolite/core}/IOHandlerTest.kt | 3 +- .../theodolite/core}/ResultsTest.kt | 3 +- .../LowerBoundRestrictionTest.kt | 2 +- .../InitialGuessSearchStrategyTest.kt | 17 +++---- .../searchstrategy}/RestrictionSearchTest.kt | 24 +++++----- .../benchmark/ActionCommandTest.kt | 3 +- .../benchmark/ErrorChannelMessage.kt | 2 +- .../benchmark}/TestBenchmarkDeployment.kt | 2 +- .../TestBenchmarkDeploymentBuilder.kt} | 13 ++--- .../execution}/TestExperimentRunnerImpl.kt | 6 +-- .../kubernetes}/k8s/K8sManagerTest.kt | 3 +- .../kubernetes/model/crd}/BenchmarkCRDummy.kt | 4 +- .../kubernetes}/model/crd/CRDExecutionTest.kt | 3 +- .../kubernetes/model/crd}/ExecutionCRDummy.kt | 5 +- .../crd}/ExecutionStateComparatorTest.kt | 5 +- .../model/crd/ExecutionStatusTest.kt | 4 +- .../operator/BenchmarkStateCheckerTest.kt | 6 +-- .../kubernetes}/operator/ControllerTest.kt | 8 +--- .../operator/ExecutionEventHandlerTest.kt | 5 +- .../ExecutionEventHandlerTestWithInformer.kt | 5 +- .../operator/ExecutionEventHandlerWrapper.kt | 2 +- .../kubernetes}/operator/StateHandlerTest.kt | 3 +- .../patcher/ConfigOverrideModifierTest.kt | 7 ++- .../patcher/ResourceLimitPatcherTest.kt | 4 +- .../patcher/ResourceRequestPatcherTest.kt | 4 +- .../resourceSet}/ConfigMapResourceSetTest.kt | 7 ++- .../resourceSet}/FileSystemResourceSetTest.kt | 3 +- .../kubernetes/slo}/SloFactoryTest.kt | 35 +++++++------- 38 files changed, 145 insertions(+), 219 deletions(-) rename theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/{Benchmark.kt => BenchmarkDeploymentBuilder.kt} (65%) rename theodolite/src/main/kotlin/rocks/theodolite/kubernetes/{execution/KubernetesExecutionRunner.kt => benchmark/KubernetesBenchmarkDeploymentBuilder.kt} (61%) rename theodolite/src/test/kotlin/{theodolite/util => rocks/theodolite/core}/IOHandlerTest.kt (98%) rename theodolite/src/test/kotlin/{theodolite/util => rocks/theodolite/core}/ResultsTest.kt (97%) rename theodolite/src/test/kotlin/{theodolite/strategies/restriction => rocks/theodolite/core/strategies/restrictionstrategy}/LowerBoundRestrictionTest.kt (98%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/core/strategies/searchstrategy}/InitialGuessSearchStrategyTest.kt (88%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/core/strategies/searchstrategy}/RestrictionSearchTest.kt (88%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/benchmark/ActionCommandTest.kt (98%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/benchmark/ErrorChannelMessage.kt (93%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes/benchmark}/TestBenchmarkDeployment.kt (79%) rename theodolite/src/test/kotlin/{theodolite/TestBenchmark.kt => rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeploymentBuilder.kt} (67%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes/execution}/TestExperimentRunnerImpl.kt (77%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/k8s/K8sManagerTest.kt (98%) rename theodolite/src/test/kotlin/{theodolite/execution/operator => rocks/theodolite/kubernetes/model/crd}/BenchmarkCRDummy.kt (90%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/model/crd/CRDExecutionTest.kt (97%) rename theodolite/src/test/kotlin/{theodolite/execution/operator => rocks/theodolite/kubernetes/model/crd}/ExecutionCRDummy.kt (89%) rename theodolite/src/test/kotlin/{theodolite/util => rocks/theodolite/kubernetes/model/crd}/ExecutionStateComparatorTest.kt (78%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/model/crd/ExecutionStatusTest.kt (97%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/BenchmarkStateCheckerTest.kt (96%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/ControllerTest.kt (92%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/ExecutionEventHandlerTest.kt (97%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/ExecutionEventHandlerTestWithInformer.kt (97%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/ExecutionEventHandlerWrapper.kt (95%) rename theodolite/src/test/kotlin/{theodolite/execution => rocks/theodolite/kubernetes}/operator/StateHandlerTest.kt (95%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/patcher/ConfigOverrideModifierTest.kt (87%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/patcher/ResourceLimitPatcherTest.kt (95%) rename theodolite/src/test/kotlin/{theodolite => rocks/theodolite/kubernetes}/patcher/ResourceRequestPatcherTest.kt (95%) rename theodolite/src/test/kotlin/{theodolite/benchmark => rocks/theodolite/kubernetes/resourceSet}/ConfigMapResourceSetTest.kt (97%) rename theodolite/src/test/kotlin/{theodolite/benchmark => rocks/theodolite/kubernetes/resourceSet}/FileSystemResourceSetTest.kt (98%) rename theodolite/src/test/kotlin/{theodolite/execution/operator => rocks/theodolite/kubernetes/slo}/SloFactoryTest.kt (63%) diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/Shutdown.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/Shutdown.kt index ce828e2df..68a5f8142 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/Shutdown.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/Shutdown.kt @@ -2,7 +2,7 @@ package rocks.theodolite.kubernetes import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging -import rocks.theodolite.kubernetes.execution.KubernetesExecutionRunner +import rocks.theodolite.kubernetes.benchmark.KubernetesBenchmarkDeploymentBuilder import rocks.theodolite.kubernetes.model.BenchmarkExecution import rocks.theodolite.kubernetes.model.KubernetesBenchmark @@ -24,11 +24,11 @@ class Shutdown(private val benchmarkExecution: BenchmarkExecution, */ fun run() { // Build Configuration to teardown - val kubernetesExecutionRunner = KubernetesExecutionRunner(benchmark, this.client) + val benchmarkDeploymentBuilder = KubernetesBenchmarkDeploymentBuilder(benchmark, this.client) try { logger.info { "Received shutdown signal -> Shutting down" } val deployment = - kubernetesExecutionRunner.buildDeployment( + benchmarkDeploymentBuilder.buildDeployment( load = 0, loadPatcherDefinitions = emptyList(), resource = 0, diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/Benchmark.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/BenchmarkDeploymentBuilder.kt similarity index 65% rename from theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/Benchmark.kt rename to theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/BenchmarkDeploymentBuilder.kt index f4030d31d..c0d7871cb 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/Benchmark.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/BenchmarkDeploymentBuilder.kt @@ -1,20 +1,12 @@ package rocks.theodolite.kubernetes.benchmark -import io.quarkus.runtime.annotations.RegisterForReflection -import rocks.theodolite.kubernetes.util.ConfigurationOverride import rocks.theodolite.kubernetes.patcher.PatcherDefinition +import rocks.theodolite.kubernetes.util.ConfigurationOverride /** - * A Benchmark contains: - * - The Resource that can be scaled for the benchmark. - * - The Load that can be scaled the benchmark. - * - additional [ConfigurationOverride]s. + * This interface is needed for test purposes. */ -@RegisterForReflection -interface Benchmark { - - fun setupInfrastructure() - fun teardownInfrastructure() +interface BenchmarkDeploymentBuilder { /** * Builds a Deployment that can be deployed. @@ -29,4 +21,4 @@ interface Benchmark { loadGenerationDelay: Long, afterTeardownDelay: Long ): BenchmarkDeployment -} +} \ No newline at end of file diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeployment.kt index 2ee621276..2e0f447cf 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeployment.kt @@ -41,6 +41,8 @@ class KubernetesBenchmarkDeployment( private val LAG_EXPORTER_POD_LABEL_NAME = "app.kubernetes.io/name" private val LAG_EXPORTER_POD_LABEL_VALUE = "kafka-exporter" + + /** * Setup a [KubernetesBenchmark] using the [TopicManager] and the [K8sManager]: * - Create the needed topics. diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/KubernetesExecutionRunner.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeploymentBuilder.kt similarity index 61% rename from theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/KubernetesExecutionRunner.kt rename to theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeploymentBuilder.kt index 34ef80941..19f7ad052 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/KubernetesExecutionRunner.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/benchmark/KubernetesBenchmarkDeploymentBuilder.kt @@ -1,52 +1,18 @@ -package rocks.theodolite.kubernetes.execution +package rocks.theodolite.kubernetes.benchmark -import io.fabric8.kubernetes.api.model.HasMetadata -import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging -import rocks.theodolite.kubernetes.benchmark.* -import rocks.theodolite.kubernetes.k8s.K8sManager import rocks.theodolite.kubernetes.model.KubernetesBenchmark import rocks.theodolite.kubernetes.patcher.PatcherFactory import rocks.theodolite.kubernetes.util.ConfigurationOverride import rocks.theodolite.kubernetes.patcher.PatcherDefinition -import rocks.theodolite.kubernetes.resourceSet.ResourceSets +import rocks.theodolite.kubernetes.resourceSet.loadKubernetesResources private val logger = KotlinLogging.logger {} -class KubernetesExecutionRunner(val kubernetesBenchmark: KubernetesBenchmark, - private var client: NamespacedKubernetesClient) : Benchmark { - - /** - * Loads [KubernetesResource]s. - * It first loads them via the [YamlParserFromFile] to check for their concrete type and afterwards initializes them using - * the [K8sResourceLoader] - */ - @Deprecated("Use `loadResourceSet` from `ResourceSets`") - fun loadKubernetesResources(resourceSet: List<ResourceSets>): Collection<Pair<String, HasMetadata>> { - return loadResources(resourceSet) - } - - private fun loadResources(resourceSet: List<ResourceSets>): Collection<Pair<String, HasMetadata>> { - return resourceSet.flatMap { it.loadResourceSet(this.client) } - } - - - override fun setupInfrastructure() { - kubernetesBenchmark.infrastructure.beforeActions.forEach { it.exec(client = client) } - val kubernetesManager = K8sManager(this.client) - loadResources(kubernetesBenchmark.infrastructure.resources) - .map { it.second } - .forEach { kubernetesManager.deploy(it) } - } - - override fun teardownInfrastructure() { - val kubernetesManager = K8sManager(this.client) - loadResources(kubernetesBenchmark.infrastructure.resources) - .map { it.second } - .forEach { kubernetesManager.remove(it) } - kubernetesBenchmark.infrastructure.afterActions.forEach { it.exec(client = client) } - } +class KubernetesBenchmarkDeploymentBuilder (val kubernetesBenchmark: KubernetesBenchmark, + private var client: NamespacedKubernetesClient) + : BenchmarkDeploymentBuilder { /** @@ -70,8 +36,8 @@ class KubernetesExecutionRunner(val kubernetesBenchmark: KubernetesBenchmark, ): BenchmarkDeployment { logger.info { "Using ${this.client.namespace} as namespace." } - val appResources = loadResources(kubernetesBenchmark.sut.resources) - val loadGenResources = loadResources(kubernetesBenchmark.loadGenerator.resources) + val appResources = loadKubernetesResources(kubernetesBenchmark.sut.resources, this.client) + val loadGenResources = loadKubernetesResources(kubernetesBenchmark.loadGenerator.resources, this.client) val patcherFactory = PatcherFactory() diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/ExperimentRunnerImpl.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/ExperimentRunnerImpl.kt index a33e9518f..d139eb88e 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/ExperimentRunnerImpl.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/ExperimentRunnerImpl.kt @@ -1,11 +1,11 @@ package rocks.theodolite.kubernetes.execution -import io.fabric8.kubernetes.client.NamespacedKubernetesClient import io.quarkus.runtime.annotations.RegisterForReflection import mu.KotlinLogging import rocks.theodolite.core.ExperimentRunner import rocks.theodolite.core.Results -import rocks.theodolite.kubernetes.benchmark.Benchmark +import rocks.theodolite.kubernetes.benchmark.BenchmarkDeploymentBuilder +import rocks.theodolite.kubernetes.benchmark.KubernetesBenchmarkDeploymentBuilder import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo import rocks.theodolite.kubernetes.util.ConfigurationOverride import rocks.theodolite.kubernetes.operator.EventCreator @@ -21,7 +21,7 @@ private val logger = KotlinLogging.logger {} @RegisterForReflection class ExperimentRunnerImpl( results: Results, - private val benchmark: Benchmark, + private val benchmarkDeploymentBuilder: BenchmarkDeploymentBuilder, private val executionDuration: Duration, private val configurationOverrides: List<ConfigurationOverride?>, private val slos: List<Slo>, @@ -74,7 +74,7 @@ class ExperimentRunnerImpl( } private fun runSingleExperiment(load: Int, resource: Int): Pair<Instant, Instant> { - val benchmarkDeployment = benchmark.buildDeployment( + val benchmarkDeployment = benchmarkDeploymentBuilder.buildDeployment( load, this.loadPatcherDefinitions, resource, diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/TheodoliteExecutor.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/TheodoliteExecutor.kt index 1dc3d4d52..157ecf655 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/TheodoliteExecutor.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/execution/TheodoliteExecutor.kt @@ -1,5 +1,6 @@ package rocks.theodolite.kubernetes.execution +import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging import rocks.theodolite.core.ExecutionRunner import rocks.theodolite.core.ExperimentRunner @@ -10,6 +11,10 @@ import rocks.theodolite.core.strategies.StrategyFactory import rocks.theodolite.core.Config import rocks.theodolite.core.IOHandler import rocks.theodolite.core.Results +import rocks.theodolite.kubernetes.benchmark.KubernetesBenchmarkDeploymentBuilder +import rocks.theodolite.kubernetes.k8s.K8sManager +import rocks.theodolite.kubernetes.model.KubernetesBenchmark +import rocks.theodolite.kubernetes.resourceSet.loadKubernetesResources import rocks.theodolite.kubernetes.slo.SloFactory import java.io.File import java.time.Duration @@ -26,14 +31,14 @@ private val logger = KotlinLogging.logger {} */ class TheodoliteExecutor( private val benchmarkExecution: BenchmarkExecution, - private val kubernetesExecutionRunner: KubernetesExecutionRunner + private val benchmark: KubernetesBenchmark, + private val client: NamespacedKubernetesClient ) { /** * An executor object, configured with the specified benchmark, evaluation method, experiment duration * and overrides which are given in the execution. */ lateinit var experimentRunner: ExperimentRunner - private val kubernetesBenchmark = kubernetesExecutionRunner.kubernetesBenchmark /** * Creates all required components to start Theodolite. @@ -51,20 +56,20 @@ class TheodoliteExecutor( val resourcePatcherDefinition = PatcherDefinitionFactory().createPatcherDefinition( benchmarkExecution.resources.resourceType, - this.kubernetesBenchmark.resourceTypes + this.benchmark.resourceTypes ) val loadDimensionPatcherDefinition = PatcherDefinitionFactory().createPatcherDefinition( benchmarkExecution.loads.loadType, - this.kubernetesBenchmark.loadTypes + this.benchmark.loadTypes ) - val slos = SloFactory().createSlos(this.benchmarkExecution, this.kubernetesBenchmark) + val slos = SloFactory().createSlos(this.benchmarkExecution, this.benchmark) experimentRunner = ExperimentRunnerImpl( - benchmark = kubernetesExecutionRunner, + benchmarkDeploymentBuilder = KubernetesBenchmarkDeploymentBuilder(this.benchmark,this.client), results = results, executionDuration = executionDuration, configurationOverrides = benchmarkExecution.configOverrides, @@ -109,14 +114,14 @@ class TheodoliteExecutor( * all experiments which are specified in the corresponding execution and benchmark objects. */ fun setupAndRunExecution() { - kubernetesExecutionRunner.setupInfrastructure() + setupInfrastructure() val ioHandler = IOHandler() val resultsFolder = ioHandler.getResultFolderURL() this.benchmarkExecution.executionId = getAndIncrementExecutionID(resultsFolder + "expID.txt") ioHandler.writeToJSONFile(this.benchmarkExecution, "${resultsFolder}exp${this.benchmarkExecution.executionId}-execution-configuration") ioHandler.writeToJSONFile( - kubernetesBenchmark, + benchmark, "${resultsFolder}exp${this.benchmarkExecution.executionId}-benchmark-configuration" ) @@ -127,7 +132,23 @@ class TheodoliteExecutor( executionRunner.run() - kubernetesExecutionRunner.teardownInfrastructure() + teardownInfrastructure() + } + + private fun setupInfrastructure() { + benchmark.infrastructure.beforeActions.forEach { it.exec(client = client) } + val kubernetesManager = K8sManager(this.client) + loadKubernetesResources(benchmark.infrastructure.resources, this.client) + .map { it.second } + .forEach { kubernetesManager.deploy(it) } + } + + private fun teardownInfrastructure() { + val kubernetesManager = K8sManager(this.client) + loadKubernetesResources(benchmark.infrastructure.resources, this.client) + .map { it.second } + .forEach { kubernetesManager.remove(it) } + benchmark.infrastructure.afterActions.forEach { it.exec(client = client) } } private fun getAndIncrementExecutionID(fileURL: String): Int { diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateChecker.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateChecker.kt index 4b1605045..c9588b576 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateChecker.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateChecker.kt @@ -1,6 +1,5 @@ package rocks.theodolite.kubernetes.operator -import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.api.model.apps.StatefulSet import io.fabric8.kubernetes.client.NamespacedKubernetesClient @@ -13,6 +12,7 @@ import rocks.theodolite.kubernetes.resourceSet.ResourceSets import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD import rocks.theodolite.kubernetes.model.crd.BenchmarkState import rocks.theodolite.kubernetes.model.crd.KubernetesBenchmarkList +import rocks.theodolite.kubernetes.resourceSet.loadKubernetesResources class BenchmarkStateChecker( private val benchmarkCRDClient: MixedOperation<BenchmarkCRD, KubernetesBenchmarkList, Resource<BenchmarkCRD>>, @@ -130,7 +130,7 @@ class BenchmarkStateChecker( * @return true if the required resources are found, else false */ fun checkIfResourceIsInfrastructure(resourcesSets: List<ResourceSets>, selector: ActionSelector): Boolean { - val resources = resourcesSets.flatMap { it.loadResourceSet(this.client) } + val resources = loadKubernetesResources(resourcesSets, this.client) if (resources.isEmpty()) { return false } @@ -177,9 +177,9 @@ class BenchmarkStateChecker( fun checkResources(benchmark: KubernetesBenchmark): BenchmarkState { return try { val appResources = - loadKubernetesResources(resourceSet = benchmark.sut.resources) + loadKubernetesResources(resourceSet = benchmark.sut.resources, this.client) val loadGenResources = - loadKubernetesResources(resourceSet = benchmark.loadGenerator.resources) + loadKubernetesResources(resourceSet = benchmark.loadGenerator.resources, this.client) if (appResources.isNotEmpty() && loadGenResources.isNotEmpty()) { BenchmarkState.READY } else { @@ -190,13 +190,7 @@ class BenchmarkStateChecker( } } - /** - * Loads [KubernetesResource]s. - * It first loads them via the [YamlParserFromFile] to check for their concrete type and afterwards initializes them. - */ - private fun loadKubernetesResources(resourceSet: List<ResourceSets>): Collection<Pair<String, KubernetesResource>> { - return resourceSet.flatMap { it.loadResourceSet(this.client) } - } + } private fun <K, V> MutableMap<K, V>.containsMatchLabels(matchLabels: MutableMap<V, V>): Boolean { diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/TheodoliteController.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/TheodoliteController.kt index a8c79c8d2..ddb081b83 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/TheodoliteController.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/operator/TheodoliteController.kt @@ -1,6 +1,5 @@ package rocks.theodolite.kubernetes.operator -import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.client.NamespacedKubernetesClient import io.fabric8.kubernetes.client.dsl.MixedOperation import io.fabric8.kubernetes.client.dsl.Resource @@ -10,12 +9,11 @@ import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD import rocks.theodolite.kubernetes.model.crd.ExecutionState import rocks.theodolite.kubernetes.model.crd.KubernetesBenchmarkList import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.execution.KubernetesExecutionRunner import rocks.theodolite.kubernetes.execution.TheodoliteExecutor import rocks.theodolite.kubernetes.model.crd.* import rocks.theodolite.kubernetes.patcher.ConfigOverrideModifier import rocks.theodolite.kubernetes.model.crd.ExecutionStateComparator -import rocks.theodolite.kubernetes.resourceSet.ResourceSets +import rocks.theodolite.kubernetes.resourceSet.loadKubernetesResources import java.lang.Thread.sleep private val logger = KotlinLogging.logger {} @@ -78,8 +76,8 @@ class TheodoliteController( try { val modifier = ConfigOverrideModifier( execution = execution, - resources = loadKubernetesResources(benchmark.sut.resources).map { it.first } - + loadKubernetesResources(benchmark.loadGenerator.resources).map { it.first } + resources = loadKubernetesResources(benchmark.sut.resources, this.client).map { it.first } + + loadKubernetesResources(benchmark.loadGenerator.resources, this.client).map { it.first } ) modifier.setAdditionalLabels( labelValue = execution.name, @@ -97,7 +95,7 @@ class TheodoliteController( executionStateHandler.setExecutionState(execution.name, ExecutionState.RUNNING) executionStateHandler.startDurationStateTimer(execution.name) - executor = TheodoliteExecutor(execution, KubernetesExecutionRunner(benchmark, this.client)) + executor = TheodoliteExecutor(execution, benchmark, this.client) executor.setupAndRunExecution() when (executionStateHandler.getExecutionState(execution.name)) { ExecutionState.RESTART -> runExecution(execution, benchmark) @@ -179,12 +177,4 @@ class TheodoliteController( if (!::executor.isInitialized) return false return this.executor.getExecution().name == executionName } - - /** - * Loads [KubernetesResource]s. - * It first loads them via the [YamlParserFromFile] to check for their concrete type and afterwards initializes them. - */ - private fun loadKubernetesResources(resourceSet: List<ResourceSets>): Collection<Pair<String, KubernetesResource>> { - return resourceSet.flatMap { it.loadResourceSet(this.client) } - } } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/resourceSet/ResourceSets.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/resourceSet/ResourceSets.kt index 403d4345e..986ab5224 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/resourceSet/ResourceSets.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/resourceSet/ResourceSets.kt @@ -9,6 +9,13 @@ import io.fabric8.kubernetes.client.NamespacedKubernetesClient import io.quarkus.runtime.annotations.RegisterForReflection import rocks.theodolite.kubernetes.util.exception.DeploymentFailedException +/** + * Loads [KubernetesResource]s. + */ +fun loadKubernetesResources(resourceSet: List<ResourceSets>, client: NamespacedKubernetesClient): Collection<Pair<String, HasMetadata>> { + return resourceSet.flatMap { it.loadResourceSet(client) } +} + @JsonDeserialize @RegisterForReflection class ResourceSets: KubernetesResource { @@ -20,14 +27,15 @@ class ResourceSets: KubernetesResource { @JsonInclude(JsonInclude.Include.NON_NULL) var fileSystem: FileSystemResourceSet? = null + fun loadResourceSet(client: NamespacedKubernetesClient): Collection<Pair<String, HasMetadata>> { // TODO Find out whether field access (::configMap) is really what we want to do here (see #362) return if (::configMap != null) { - configMap?.getResourceSet(client= client) !! - } else if (::fileSystem != null) { - fileSystem?.getResourceSet(client= client ) !! - } else { - throw DeploymentFailedException("Could not load resourceSet.") - } + configMap?.getResourceSet(client= client) !! + } else if (::fileSystem != null) { + fileSystem?.getResourceSet(client= client ) !! + } else { + throw DeploymentFailedException("Could not load resourceSet.") + } } } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/standalone/TheodoliteStandalone.kt b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/standalone/TheodoliteStandalone.kt index 95092edf3..bddbee80f 100644 --- a/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/standalone/TheodoliteStandalone.kt +++ b/theodolite/src/main/kotlin/rocks/theodolite/kubernetes/standalone/TheodoliteStandalone.kt @@ -4,7 +4,6 @@ import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging import rocks.theodolite.kubernetes.model.BenchmarkExecution import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.execution.KubernetesExecutionRunner import rocks.theodolite.kubernetes.execution.TheodoliteExecutor import rocks.theodolite.kubernetes.util.YamlParserFromFile import rocks.theodolite.kubernetes.util.exception.EvaluationFailedException @@ -57,7 +56,7 @@ class TheodoliteStandalone (private val client: NamespacedKubernetesClient) { Runtime.getRuntime().addShutdownHook(shutdown) try { - TheodoliteExecutor(benchmarkExecution, KubernetesExecutionRunner(benchmark, client)).setupAndRunExecution() + TheodoliteExecutor(benchmarkExecution, benchmark, client).setupAndRunExecution() } catch (e: EvaluationFailedException) { logger.error { "Evaluation failed with error: ${e.message}" } }catch (e: ExecutionFailedException) { diff --git a/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/core/IOHandlerTest.kt similarity index 98% rename from theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/core/IOHandlerTest.kt index 8f25f2ea2..65e84d7dd 100644 --- a/theodolite/src/test/kotlin/theodolite/util/IOHandlerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/core/IOHandlerTest.kt @@ -1,4 +1,4 @@ -package theodolite.util +package rocks.theodolite.core import com.google.gson.GsonBuilder import io.quarkus.test.junit.QuarkusTest @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test import org.junit.rules.TemporaryFolder import org.junitpioneer.jupiter.ClearEnvironmentVariable import org.junitpioneer.jupiter.SetEnvironmentVariable -import rocks.theodolite.core.IOHandler const val FOLDER_URL = "Test-Folder" diff --git a/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/core/ResultsTest.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/core/ResultsTest.kt index 70ea1e2cd..2dbeb44b9 100644 --- a/theodolite/src/test/kotlin/theodolite/util/ResultsTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/core/ResultsTest.kt @@ -1,11 +1,10 @@ -package theodolite.util +package rocks.theodolite.core import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull import org.junit.jupiter.api.Test import rocks.theodolite.core.strategies.Metric -import rocks.theodolite.core.Results @QuarkusTest internal class ResultsTest { diff --git a/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/restrictionstrategy/LowerBoundRestrictionTest.kt similarity index 98% rename from theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/core/strategies/restrictionstrategy/LowerBoundRestrictionTest.kt index 4adf3dfdd..79fadb486 100644 --- a/theodolite/src/test/kotlin/theodolite/strategies/restriction/LowerBoundRestrictionTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/restrictionstrategy/LowerBoundRestrictionTest.kt @@ -1,4 +1,4 @@ -package theodolite.strategies.restriction +package rocks.theodolite.core.strategies.restrictionstrategy import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotNull diff --git a/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/InitialGuessSearchStrategyTest.kt similarity index 88% rename from theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/InitialGuessSearchStrategyTest.kt index 16d3279fa..2439d3301 100644 --- a/theodolite/src/test/kotlin/theodolite/InitialGuessSearchStrategyTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/InitialGuessSearchStrategyTest.kt @@ -1,12 +1,13 @@ -package theodolite +package rocks.theodolite.core.strategies.searchstrategy import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import rocks.theodolite.core.strategies.Metric import mu.KotlinLogging +import rocks.theodolite.kubernetes.benchmark.TestBenchmarkDeploymentBuilder +import rocks.theodolite.kubernetes.execution.TestExperimentRunnerImpl import rocks.theodolite.core.strategies.guessstrategy.PrevInstanceOptGuess -import rocks.theodolite.core.strategies.searchstrategy.InitialGuessSearchStrategy import rocks.theodolite.core.Results import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo @@ -29,10 +30,10 @@ class InitialGuessSearchStrategyTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val guessStrategy = PrevInstanceOptGuess() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 5) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor,guessStrategy, results) val actual: ArrayList<Int?> = ArrayList() @@ -67,10 +68,10 @@ class InitialGuessSearchStrategyTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val guessStrategy = PrevInstanceOptGuess() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 5) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor,guessStrategy, results) val actual: ArrayList<Int?> = ArrayList() @@ -105,10 +106,10 @@ class InitialGuessSearchStrategyTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val guessStrategy = PrevInstanceOptGuess() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 5) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val strategy = InitialGuessSearchStrategy(benchmarkExecutor, guessStrategy, results) val actual: ArrayList<Int?> = ArrayList() diff --git a/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/RestrictionSearchTest.kt similarity index 88% rename from theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/RestrictionSearchTest.kt index 3dfea28e3..afb934a3d 100644 --- a/theodolite/src/test/kotlin/theodolite/RestrictionSearchTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/core/strategies/searchstrategy/RestrictionSearchTest.kt @@ -1,15 +1,13 @@ -package theodolite +package rocks.theodolite.core.strategies.searchstrategy import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import rocks.theodolite.kubernetes.benchmark.TestBenchmarkDeploymentBuilder +import rocks.theodolite.kubernetes.execution.TestExperimentRunnerImpl import rocks.theodolite.core.strategies.Metric import rocks.theodolite.core.strategies.restrictionstrategy.LowerBoundRestriction -import rocks.theodolite.core.strategies.searchstrategy.BinarySearch -import rocks.theodolite.core.strategies.searchstrategy.FullSearch -import rocks.theodolite.core.strategies.searchstrategy.LinearSearch -import rocks.theodolite.core.strategies.searchstrategy.RestrictionSearch import rocks.theodolite.core.Results import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo @@ -31,9 +29,9 @@ class RestrictionSearchTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 5) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val linearSearch = LinearSearch(benchmarkExecutor) val lowerBoundRestriction = LowerBoundRestriction(results) val strategy = @@ -64,9 +62,9 @@ class RestrictionSearchTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 5) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 5) val fullSearch = FullSearch(benchmarkExecutor) val lowerBoundRestriction = LowerBoundRestriction(results) val strategy = @@ -97,10 +95,10 @@ class RestrictionSearchTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..6).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val sloChecker: Slo = Slo() val benchmarkExecutorImpl = - TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 0) + TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 0) val binarySearch = BinarySearch(benchmarkExecutorImpl) val lowerBoundRestriction = LowerBoundRestriction(results) val strategy = RestrictionSearch(benchmarkExecutorImpl, binarySearch, setOf(lowerBoundRestriction)) @@ -130,9 +128,9 @@ class RestrictionSearchTest { val mockLoads: List<Int> = (0..6).toList() val mockResources: List<Int> = (0..7).toList() val results = Results(Metric.from("demand")) - val benchmark = TestBenchmark() + val benchmarkDeploymentBuilder = TestBenchmarkDeploymentBuilder() val sloChecker: Slo = Slo() - val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmark, listOf(sloChecker), 0, 0, 0) + val benchmarkExecutor = TestExperimentRunnerImpl(results, mockResults, benchmarkDeploymentBuilder, listOf(sloChecker), 0, 0, 0) val binarySearch = BinarySearch(benchmarkExecutor) val lowerBoundRestriction = LowerBoundRestriction(results) val strategy = diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ActionCommandTest.kt similarity index 98% rename from theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ActionCommandTest.kt index e88aeb1e3..92f7d27ae 100644 --- a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ActionCommandTest.kt @@ -1,4 +1,4 @@ -package theodolite.benchmark +package rocks.theodolite.kubernetes.benchmark import io.fabric8.kubernetes.api.model.Pod import io.fabric8.kubernetes.api.model.PodBuilder @@ -8,7 +8,6 @@ import io.fabric8.kubernetes.client.utils.Utils import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.* import org.junit.jupiter.api.Assertions.assertEquals -import rocks.theodolite.kubernetes.benchmark.* import rocks.theodolite.kubernetes.operator.TheodoliteController import rocks.theodolite.kubernetes.operator.TheodoliteOperator import rocks.theodolite.kubernetes.util.exception.ActionCommandFailedException diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ErrorChannelMessage.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ErrorChannelMessage.kt similarity index 93% rename from theodolite/src/test/kotlin/theodolite/benchmark/ErrorChannelMessage.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ErrorChannelMessage.kt index df57a2529..e920776ae 100644 --- a/theodolite/src/test/kotlin/theodolite/benchmark/ErrorChannelMessage.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/ErrorChannelMessage.kt @@ -1,4 +1,4 @@ -package theodolite.benchmark +package rocks.theodolite.kubernetes.benchmark import io.fabric8.mockwebserver.internal.WebSocketMessage import java.nio.charset.StandardCharsets diff --git a/theodolite/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeployment.kt similarity index 79% rename from theodolite/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeployment.kt index 098598ce1..881ed6977 100644 --- a/theodolite/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeployment.kt @@ -1,4 +1,4 @@ -package theodolite +package rocks.theodolite.kubernetes.benchmark import rocks.theodolite.kubernetes.benchmark.BenchmarkDeployment diff --git a/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeploymentBuilder.kt similarity index 67% rename from theodolite/src/test/kotlin/theodolite/TestBenchmark.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeploymentBuilder.kt index 019d8cd26..0c0c03e7c 100644 --- a/theodolite/src/test/kotlin/theodolite/TestBenchmark.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/benchmark/TestBenchmarkDeploymentBuilder.kt @@ -1,17 +1,10 @@ -package theodolite +package rocks.theodolite.kubernetes.benchmark + -import rocks.theodolite.kubernetes.benchmark.Benchmark -import rocks.theodolite.kubernetes.benchmark.BenchmarkDeployment import rocks.theodolite.kubernetes.util.ConfigurationOverride import rocks.theodolite.kubernetes.patcher.PatcherDefinition -class TestBenchmark : Benchmark { - - override fun setupInfrastructure() { - } - - override fun teardownInfrastructure() { - } +class TestBenchmarkDeploymentBuilder(): BenchmarkDeploymentBuilder { override fun buildDeployment( load: Int, diff --git a/theodolite/src/test/kotlin/theodolite/TestExperimentRunnerImpl.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/execution/TestExperimentRunnerImpl.kt similarity index 77% rename from theodolite/src/test/kotlin/theodolite/TestExperimentRunnerImpl.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/execution/TestExperimentRunnerImpl.kt index 5032e9315..7f862e108 100644 --- a/theodolite/src/test/kotlin/theodolite/TestExperimentRunnerImpl.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/execution/TestExperimentRunnerImpl.kt @@ -1,14 +1,14 @@ -package theodolite +package rocks.theodolite.kubernetes.execution +import rocks.theodolite.kubernetes.benchmark.TestBenchmarkDeploymentBuilder import rocks.theodolite.core.Results -import rocks.theodolite.kubernetes.benchmark.Benchmark import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo import rocks.theodolite.core.ExperimentRunner class TestExperimentRunnerImpl( results: Results, private val mockResults: Array<Array<Boolean>>, - private val benchmark: Benchmark, + private val benchmarkDeploymentBuilder: TestBenchmarkDeploymentBuilder, private val slo: List<Slo>, private val executionId: Int, private val loadGenerationDelay: Long, diff --git a/theodolite/src/test/kotlin/theodolite/k8s/K8sManagerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/k8s/K8sManagerTest.kt similarity index 98% rename from theodolite/src/test/kotlin/theodolite/k8s/K8sManagerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/k8s/K8sManagerTest.kt index 1aba07bb4..92adf08fb 100644 --- a/theodolite/src/test/kotlin/theodolite/k8s/K8sManagerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/k8s/K8sManagerTest.kt @@ -1,4 +1,4 @@ -package theodolite.k8s +package rocks.theodolite.kubernetes.k8s import io.fabric8.kubernetes.api.model.* import io.fabric8.kubernetes.api.model.apps.Deployment @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import registerResource -import rocks.theodolite.kubernetes.k8s.K8sManager @QuarkusTest diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkCRDummy.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/BenchmarkCRDummy.kt similarity index 90% rename from theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkCRDummy.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/BenchmarkCRDummy.kt index 9a0307d4a..f1baf75df 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkCRDummy.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/BenchmarkCRDummy.kt @@ -1,8 +1,6 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.model.crd import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD -import rocks.theodolite.kubernetes.model.crd.KafkaConfig class BenchmarkCRDummy(name: String) { diff --git a/theodolite/src/test/kotlin/theodolite/model/crd/CRDExecutionTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/CRDExecutionTest.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/model/crd/CRDExecutionTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/CRDExecutionTest.kt index 7e7ade594..a7de76acf 100644 --- a/theodolite/src/test/kotlin/theodolite/model/crd/CRDExecutionTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/CRDExecutionTest.kt @@ -1,4 +1,4 @@ -package theodolite.model.crd +package rocks.theodolite.kubernetes.model.crd import io.fabric8.kubernetes.api.model.KubernetesResourceList import io.fabric8.kubernetes.client.dsl.MixedOperation @@ -15,7 +15,6 @@ import org.mockito.kotlin.mock import rocks.theodolite.kubernetes.operator.ExecutionEventHandler import rocks.theodolite.kubernetes.operator.ExecutionStateHandler import rocks.theodolite.kubernetes.operator.TheodoliteController -import rocks.theodolite.kubernetes.model.crd.ExecutionCRD import rocks.theodolite.kubernetes.util.ConfigurationOverride import java.io.FileInputStream diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionCRDummy.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionCRDummy.kt similarity index 89% rename from theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionCRDummy.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionCRDummy.kt index b0b768595..871471ee9 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionCRDummy.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionCRDummy.kt @@ -1,9 +1,6 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.model.crd import rocks.theodolite.kubernetes.model.BenchmarkExecution -import rocks.theodolite.kubernetes.model.crd.ExecutionCRD -import rocks.theodolite.kubernetes.model.crd.ExecutionState -import rocks.theodolite.kubernetes.model.crd.ExecutionStatus class ExecutionCRDummy(name: String, benchmark: String) { diff --git a/theodolite/src/test/kotlin/theodolite/util/ExecutionStateComparatorTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStateComparatorTest.kt similarity index 78% rename from theodolite/src/test/kotlin/theodolite/util/ExecutionStateComparatorTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStateComparatorTest.kt index 8e2262673..14186ef40 100644 --- a/theodolite/src/test/kotlin/theodolite/util/ExecutionStateComparatorTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStateComparatorTest.kt @@ -1,11 +1,8 @@ -package theodolite.util +package rocks.theodolite.kubernetes.model.crd import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import theodolite.execution.operator.ExecutionCRDummy -import rocks.theodolite.kubernetes.model.crd.ExecutionState -import rocks.theodolite.kubernetes.model.crd.ExecutionStateComparator @QuarkusTest diff --git a/theodolite/src/test/kotlin/theodolite/model/crd/ExecutionStatusTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStatusTest.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/model/crd/ExecutionStatusTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStatusTest.kt index 2395ee877..4c9326ac2 100644 --- a/theodolite/src/test/kotlin/theodolite/model/crd/ExecutionStatusTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/model/crd/ExecutionStatusTest.kt @@ -1,4 +1,4 @@ -package theodolite.model.crd +package rocks.theodolite.kubernetes.model.crd import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.exc.InvalidFormatException @@ -7,8 +7,6 @@ import io.fabric8.kubernetes.api.model.Duration as K8sDuration import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import rocks.theodolite.kubernetes.model.crd.ExecutionState -import rocks.theodolite.kubernetes.model.crd.ExecutionStatus import java.time.Clock import java.time.Duration import java.time.Instant diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkStateCheckerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateCheckerTest.kt similarity index 96% rename from theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkStateCheckerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateCheckerTest.kt index 53d8d4b68..640aa4255 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/BenchmarkStateCheckerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/BenchmarkStateCheckerTest.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import com.google.gson.Gson import io.fabric8.kubernetes.api.model.ConfigMapBuilder @@ -14,11 +14,9 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.* import rocks.theodolite.kubernetes.benchmark.* -import rocks.theodolite.kubernetes.operator.BenchmarkStateChecker -import rocks.theodolite.kubernetes.operator.TheodoliteOperator import rocks.theodolite.kubernetes.model.crd.BenchmarkState import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.execution.KubernetesExecutionRunner +import rocks.theodolite.kubernetes.model.crd.BenchmarkCRDummy import rocks.theodolite.kubernetes.resourceSet.ConfigMapResourceSet import rocks.theodolite.kubernetes.resourceSet.ResourceSets diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/ControllerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ControllerTest.kt similarity index 92% rename from theodolite/src/test/kotlin/theodolite/execution/operator/ControllerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ControllerTest.kt index 144bf2717..3120d7420 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/ControllerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ControllerTest.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import com.google.gson.Gson import com.google.gson.GsonBuilder @@ -12,11 +12,7 @@ import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import rocks.theodolite.kubernetes.model.BenchmarkExecution import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.operator.TheodoliteController -import rocks.theodolite.kubernetes.operator.TheodoliteOperator -import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD -import rocks.theodolite.kubernetes.model.crd.BenchmarkState -import rocks.theodolite.kubernetes.model.crd.ExecutionCRD +import rocks.theodolite.kubernetes.model.crd.* @QuarkusTest diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTest.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTest.kt index 00257dc34..e794ae163 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTest.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import io.fabric8.kubernetes.api.model.KubernetesResourceList import io.fabric8.kubernetes.client.dsl.MixedOperation @@ -16,9 +16,6 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.mockito.kotlin.* -import rocks.theodolite.kubernetes.operator.ExecutionEventHandler -import rocks.theodolite.kubernetes.operator.ExecutionStateHandler -import rocks.theodolite.kubernetes.operator.TheodoliteController import rocks.theodolite.kubernetes.model.crd.ExecutionCRD import rocks.theodolite.kubernetes.model.crd.ExecutionState import java.io.FileInputStream diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTestWithInformer.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTestWithInformer.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTestWithInformer.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTestWithInformer.kt index b57a7a514..63a669fe6 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerTestWithInformer.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerTestWithInformer.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import io.fabric8.kubernetes.client.dsl.Resource import io.fabric8.kubernetes.client.server.mock.KubernetesServer @@ -11,9 +11,6 @@ import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.mockito.kotlin.* -import rocks.theodolite.kubernetes.operator.ExecutionEventHandler -import rocks.theodolite.kubernetes.operator.ExecutionStateHandler -import rocks.theodolite.kubernetes.operator.TheodoliteController import rocks.theodolite.kubernetes.model.crd.ExecutionCRD import rocks.theodolite.kubernetes.model.crd.ExecutionState import java.io.FileInputStream diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerWrapper.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerWrapper.kt similarity index 95% rename from theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerWrapper.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerWrapper.kt index 471c59fe4..43ff721bd 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/ExecutionEventHandlerWrapper.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/ExecutionEventHandlerWrapper.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import io.fabric8.kubernetes.client.informers.ResourceEventHandler import rocks.theodolite.kubernetes.operator.ExecutionEventHandler diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/StateHandlerTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/StateHandlerTest.kt similarity index 95% rename from theodolite/src/test/kotlin/theodolite/execution/operator/StateHandlerTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/StateHandlerTest.kt index 5ca278176..a7c7c5caa 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/StateHandlerTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/operator/StateHandlerTest.kt @@ -1,4 +1,4 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.operator import io.fabric8.kubernetes.client.server.mock.KubernetesServer import io.quarkus.test.junit.QuarkusTest @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test import rocks.theodolite.kubernetes.k8s.K8sManager import rocks.theodolite.kubernetes.model.crd.ExecutionCRD import rocks.theodolite.kubernetes.model.crd.ExecutionState -import rocks.theodolite.kubernetes.operator.ExecutionStateHandler @QuarkusTest @WithKubernetesTestServer diff --git a/theodolite/src/test/kotlin/theodolite/patcher/ConfigOverrideModifierTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ConfigOverrideModifierTest.kt similarity index 87% rename from theodolite/src/test/kotlin/theodolite/patcher/ConfigOverrideModifierTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ConfigOverrideModifierTest.kt index 5dafdd600..617245400 100644 --- a/theodolite/src/test/kotlin/theodolite/patcher/ConfigOverrideModifierTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ConfigOverrideModifierTest.kt @@ -1,4 +1,4 @@ -package theodolite.patcher +package rocks.theodolite.kubernetes.patcher import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions @@ -6,9 +6,8 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import rocks.theodolite.kubernetes.model.BenchmarkExecution import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.patcher.ConfigOverrideModifier -import theodolite.execution.operator.BenchmarkCRDummy -import theodolite.execution.operator.ExecutionCRDummy +import rocks.theodolite.kubernetes.model.crd.BenchmarkCRDummy +import rocks.theodolite.kubernetes.model.crd.ExecutionCRDummy @QuarkusTest class ConfigOverrideModifierTest { diff --git a/theodolite/src/test/kotlin/theodolite/patcher/ResourceLimitPatcherTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceLimitPatcherTest.kt similarity index 95% rename from theodolite/src/test/kotlin/theodolite/patcher/ResourceLimitPatcherTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceLimitPatcherTest.kt index d1435e489..f8ac6e904 100644 --- a/theodolite/src/test/kotlin/theodolite/patcher/ResourceLimitPatcherTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceLimitPatcherTest.kt @@ -1,4 +1,4 @@ -package theodolite.patcher +package rocks.theodolite.kubernetes.patcher import io.fabric8.kubernetes.client.server.mock.KubernetesServer import io.quarkus.test.junit.QuarkusTest @@ -7,8 +7,6 @@ import io.quarkus.test.kubernetes.client.WithKubernetesTestServer import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test -import rocks.theodolite.kubernetes.patcher.PatcherFactory -import rocks.theodolite.kubernetes.patcher.PatcherDefinition /** * Resource patcher test diff --git a/theodolite/src/test/kotlin/theodolite/patcher/ResourceRequestPatcherTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceRequestPatcherTest.kt similarity index 95% rename from theodolite/src/test/kotlin/theodolite/patcher/ResourceRequestPatcherTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceRequestPatcherTest.kt index d24f7c140..7eee2cad4 100644 --- a/theodolite/src/test/kotlin/theodolite/patcher/ResourceRequestPatcherTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/patcher/ResourceRequestPatcherTest.kt @@ -1,4 +1,4 @@ -package theodolite.patcher +package rocks.theodolite.kubernetes.patcher import io.fabric8.kubernetes.client.server.mock.KubernetesServer import io.quarkus.test.junit.QuarkusTest @@ -6,8 +6,6 @@ import io.quarkus.test.kubernetes.client.KubernetesTestServer import io.quarkus.test.kubernetes.client.WithKubernetesTestServer import io.smallrye.common.constraint.Assert.assertTrue import org.junit.jupiter.api.Test -import rocks.theodolite.kubernetes.patcher.PatcherDefinition -import rocks.theodolite.kubernetes.patcher.PatcherFactory /** * Resource patcher test diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ConfigMapResourceSetTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/ConfigMapResourceSetTest.kt similarity index 97% rename from theodolite/src/test/kotlin/theodolite/benchmark/ConfigMapResourceSetTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/ConfigMapResourceSetTest.kt index 1380b1d91..ad856ca7a 100644 --- a/theodolite/src/test/kotlin/theodolite/benchmark/ConfigMapResourceSetTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/ConfigMapResourceSetTest.kt @@ -1,4 +1,4 @@ -package theodolite.benchmark +package rocks.theodolite.kubernetes.resourceSet import com.fasterxml.jackson.databind.ObjectMapper import io.fabric8.kubernetes.api.model.* @@ -20,11 +20,10 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows import registerResource -import theodolite.execution.operator.BenchmarkCRDummy -import theodolite.execution.operator.ExecutionClient +import rocks.theodolite.kubernetes.model.crd.BenchmarkCRDummy +import rocks.theodolite.kubernetes.operator.ExecutionClient import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD import rocks.theodolite.kubernetes.model.crd.ExecutionCRD -import rocks.theodolite.kubernetes.resourceSet.ConfigMapResourceSet import rocks.theodolite.kubernetes.util.exception.DeploymentFailedException import java.io.FileInputStream diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/FileSystemResourceSetTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/FileSystemResourceSetTest.kt similarity index 98% rename from theodolite/src/test/kotlin/theodolite/benchmark/FileSystemResourceSetTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/FileSystemResourceSetTest.kt index 748a33c5c..a9a57d8cf 100644 --- a/theodolite/src/test/kotlin/theodolite/benchmark/FileSystemResourceSetTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/resourceSet/FileSystemResourceSetTest.kt @@ -1,4 +1,4 @@ -package theodolite.benchmark +package rocks.theodolite.kubernetes.resourceSet import io.fabric8.kubernetes.api.model.* import io.fabric8.kubernetes.api.model.apps.Deployment @@ -15,7 +15,6 @@ import org.junit.jupiter.api.io.TempDir import registerResource import rocks.theodolite.kubernetes.model.crd.BenchmarkCRD import rocks.theodolite.kubernetes.model.crd.ExecutionCRD -import rocks.theodolite.kubernetes.resourceSet.FileSystemResourceSet import rocks.theodolite.kubernetes.util.exception.DeploymentFailedException import java.io.FileInputStream import java.nio.file.Files diff --git a/theodolite/src/test/kotlin/theodolite/execution/operator/SloFactoryTest.kt b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/slo/SloFactoryTest.kt similarity index 63% rename from theodolite/src/test/kotlin/theodolite/execution/operator/SloFactoryTest.kt rename to theodolite/src/test/kotlin/rocks/theodolite/kubernetes/slo/SloFactoryTest.kt index 9279448c5..de9d4c60d 100644 --- a/theodolite/src/test/kotlin/theodolite/execution/operator/SloFactoryTest.kt +++ b/theodolite/src/test/kotlin/rocks/theodolite/kubernetes/slo/SloFactoryTest.kt @@ -1,13 +1,10 @@ -package theodolite.execution.operator +package rocks.theodolite.kubernetes.slo import io.quarkus.test.junit.QuarkusTest +import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import rocks.theodolite.kubernetes.model.BenchmarkExecution -import rocks.theodolite.kubernetes.model.BenchmarkExecution.SloConfiguration -import rocks.theodolite.kubernetes.slo.SloFactory -import org.junit.jupiter.api.Assertions.* import rocks.theodolite.kubernetes.model.KubernetesBenchmark -import rocks.theodolite.kubernetes.model.KubernetesBenchmark.Slo @QuarkusTest internal class SloFactoryTest { @@ -19,7 +16,7 @@ internal class SloFactoryTest { val execution = BenchmarkExecution() // Define Benchmark SLOs - val slo = Slo() + val slo = KubernetesBenchmark.Slo() slo.name="test" slo.sloType="lag trend" slo.prometheusUrl="test.de" @@ -36,7 +33,7 @@ internal class SloFactoryTest { // Define Execution SLOs, benchmark SLO values for these properties should be overwritten - val sloConfig = SloConfiguration() + val sloConfig = BenchmarkExecution.SloConfiguration() sloConfig.name = "test" val executionSloProperties = mutableMapOf<String, String>() @@ -48,7 +45,7 @@ internal class SloFactoryTest { sloConfig.properties = executionSloProperties // SLO has 'name' that isn't defined in the benchmark, therefore it will be ignored by the SloFactory - val sloConfig2 = SloConfiguration() + val sloConfig2 = BenchmarkExecution.SloConfiguration() sloConfig2.name = "test2" sloConfig2.properties = executionSloProperties @@ -57,16 +54,16 @@ internal class SloFactoryTest { val sloFactory = SloFactory() val combinedSlos = sloFactory.createSlos(execution,benchmark) - assertEquals(1, combinedSlos.size) - assertEquals("test", combinedSlos[0].name) - assertEquals("lag trend", combinedSlos[0].sloType) - assertEquals("test.de", combinedSlos[0].prometheusUrl) - assertEquals(0, combinedSlos[0].offset) - - assertEquals(4, combinedSlos[0].properties.size) - assertEquals("3000", combinedSlos[0].properties["threshold"]) - assertEquals("http://localhost:80/evaluate-slope", combinedSlos[0].properties["externalSloUrl"]) - assertEquals("80", combinedSlos[0].properties["warmup"]) - assertEquals("extended", combinedSlos[0].properties["extensionTest"]) + Assertions.assertEquals(1, combinedSlos.size) + Assertions.assertEquals("test", combinedSlos[0].name) + Assertions.assertEquals("lag trend", combinedSlos[0].sloType) + Assertions.assertEquals("test.de", combinedSlos[0].prometheusUrl) + Assertions.assertEquals(0, combinedSlos[0].offset) + + Assertions.assertEquals(4, combinedSlos[0].properties.size) + Assertions.assertEquals("3000", combinedSlos[0].properties["threshold"]) + Assertions.assertEquals("http://localhost:80/evaluate-slope", combinedSlos[0].properties["externalSloUrl"]) + Assertions.assertEquals("80", combinedSlos[0].properties["warmup"]) + Assertions.assertEquals("extended", combinedSlos[0].properties["extensionTest"]) } } \ No newline at end of file -- GitLab