diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt index ef9e1a458aa39502de315d5fad4c622f3d047db5..2d2332fc43ac2be558f34321d6a7b9007c792ec2 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/Main.kt @@ -3,6 +3,7 @@ package theodolite import io.quarkus.runtime.annotations.QuarkusMain import mu.KotlinLogging import theodolite.execution.TheodoliteYamlExecutor +import kotlin.system.exitProcess private val logger = KotlinLogging.logger {} @@ -10,9 +11,9 @@ private val logger = KotlinLogging.logger {} object Main { @JvmStatic fun main(args: Array<String>) { - //val theodolite = TheodoliteExecutor() - val theodolite = TheodoliteYamlExecutor() - theodolite.run() - logger.info("Application started") + logger.info { "Theodolite started" } + TheodoliteYamlExecutor().run() + logger.info { "Theodolite finished" } + exitProcess(0) } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt index a0fed22533fef06c3c3bee7342d527a6a45c038a..2c30bea402bfe97bece2967500b57025c5ab8a3f 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmarkDeployment.kt @@ -21,7 +21,7 @@ class KubernetesBenchmarkDeployment( override fun setup() { this.workloadGeneratorStateCleaner.deleteState() kafkaController.createTopics(this.topics) - resources.forEach { + resources.forEach { kubernetesManager.deploy(it) } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index 763f2d9d8d0095c4722f99de05c5ec6bf91f1392..c6694943d347e64aa6d5a66c70d9a9ba3837c1a1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -30,8 +30,6 @@ class TheodoliteExecutor( restrictionStrategies = strategyFactory.createRestrictionStrategy(results, config.execution.restrictions))) } - - fun run() { val config = buildConfig() diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt index c0b4e5bacaa55f70af323a5e88b04b00dbdb9f19..c297894f85844301a61ebd0679d55b54d148b579 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt @@ -6,7 +6,7 @@ import theodolite.benchmark.KubernetesBenchmark class TheodoliteYamlExecutor { fun run() { - // load the Benchmark context and the benchmark type + // load the BenchmarkExecution and the BenchmarkType var parser = YamlParser() val benchmarkExecution = parser.parse("./../../../resources/main/yaml/testBenchmarkExecution.yaml", BenchmarkExecution::class.java) !! val benchmark = parser.parse("./../../../resources/main/yaml/testBenchmarkType.yaml", KubernetesBenchmark::class.java) !! diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt index 6be09ce26770e7b4e535c3cd6dcb95073e0c05be..a34efc90fd55f352712bc853422d4aacb31756d1 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sResourceLoader.kt @@ -5,7 +5,6 @@ import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.Service import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition import io.fabric8.kubernetes.api.model.apps.Deployment -import io.fabric8.kubernetes.api.model.apps.StatefulSet import io.fabric8.kubernetes.client.NamespacedKubernetesClient import mu.KotlinLogging @@ -14,21 +13,21 @@ private val logger = KotlinLogging.logger {} class K8sResourceLoader(private val client: NamespacedKubernetesClient) { /** - * Parses a Service from a servive yaml + * Parses a Service from a service yaml * @param path of the yaml file * @return service from fabric8 */ private fun loadService(path: String): Service { - return loadGenericRessource(path) { x: String -> client.services().load(x).get() } + return loadGenericResource(path) { x: String -> client.services().load(x).get() } } /** - * Parses a Service from a servive yaml + * Parses a Service from a service yaml * @param path of the yaml file * @return service from fabric8 */ private fun loadServiceMonitor(path: String): CustomResourceDefinition { - return loadGenericRessource(path) { x: String -> client.customResourceDefinitions().load(x).get() } + return loadGenericResource(path) { x: String -> client.customResourceDefinitions().load(x).get() } } /** @@ -37,7 +36,7 @@ class K8sResourceLoader(private val client: NamespacedKubernetesClient) { * @return Deployment from fabric8 */ private fun loadDeployment(path: String): Deployment { - return loadGenericRessource(path) { x: String -> client.apps().deployments().load(x).get() } + return loadGenericResource(path) { x: String -> client.apps().deployments().load(x).get() } } /** @@ -46,38 +45,37 @@ class K8sResourceLoader(private val client: NamespacedKubernetesClient) { * @return ConfigMap from fabric8 */ private fun loadConfigmap(path: String): ConfigMap { - return loadGenericRessource(path) { x: String -> client.configMaps().load(x).get() } + return loadGenericResource(path) { x: String -> client.configMaps().load(x).get() } } /** * Generic helper function to load a resource. * @param path of the resource - * @param f fuction that shall be applied to the resource. + * @param f function that shall be applied to the resource. */ - private fun <T> loadGenericRessource(path: String, f: (String) -> T): T { + private fun <T> loadGenericResource(path: String, f: (String) -> T): T { var resource: T? = null try { resource = f(path) } catch (e: Exception) { - logger.info("You potentially misspelled the path: $path") - logger.info("$e") + logger.warn {"You potentially misspelled the path: $path"} + logger.warn { e } } if (resource == null) { throw IllegalArgumentException("The Resource at path: $path could not be loaded") } - return resource } - public fun loadK8sResource(kind: String, path: String): KubernetesResource { + fun loadK8sResource(kind: String, path: String): KubernetesResource { return when (kind){ "Deployment" -> loadDeployment(path) "Service" -> loadService(path) "ServiceMonitor" -> loadServiceMonitor(path) "ConfigMap" -> loadConfigmap(path) - else -> return loadConfigmap(path) // throw java.lang.IllegalArgumentException("Resource typ $kind not known") + else -> throw IllegalArgumentException("Unknown resource with type $kind located in $path") } } } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/Results.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/Results.kt index cf3da20d206a06556e9ef6f6ce2488f8bf210a29..b46286f5a968f38b327721c78172455d8a2704a2 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/Results.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/Results.kt @@ -1,9 +1,5 @@ package theodolite.util -import theodolite.util.LoadDimension -import theodolite.util.Resource -import kotlin.math.exp - class Results { private val results: MutableMap<Pair<LoadDimension, Resource>, Boolean> = mutableMapOf() diff --git a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkExecution.yaml b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkExecution.yaml index dffbe430e1a5114ab1a7bd3a2b9d08de1d8dc946..cbb4bf3b55abca623e1f809bb6845c63cfd26e81 100644 --- a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkExecution.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkExecution.yaml @@ -13,7 +13,7 @@ slos: threshold: 1000 execution: strategy: "LinearSearch" - duration: 120 + duration: 300 repititions: 1 restrictions: - "LowerBound" diff --git a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml index dc820e4655002ca45b109fcdda50874f156624f4..c36859c64bbc1cfcabbc973dd65f6142306e56de 100644 --- a/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/testBenchmarkType.yaml @@ -21,7 +21,7 @@ kafkaConfig: bootstrapServer: "localhost:31290" topics: - name: "input" - numPartitions: 1 + numPartitions: 40 replicationFactor: 1 zookeeperConfig: server: "localhost:31953" \ No newline at end of file diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt index f982dd18b7e08a7dda3200cdde6c0de1b9a6a686..7975da57a5aec207010e364e46b668b883447f94 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/CompositeStrategyTest.kt @@ -3,12 +3,10 @@ package theodolite import io.quarkus.test.junit.QuarkusTest import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Test -import theodolite.benchmark.TestBenchmark import theodolite.strategies.searchstrategy.LinearSearch import theodolite.strategies.searchstrategy.BinarySearch import theodolite.strategies.restriction.LowerBoundRestriction import theodolite.strategies.searchstrategy.CompositeStrategy -import theodolite.execution.TestBenchmarkExecutorImpl import theodolite.util.* import java.util.* diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmark.kt similarity index 78% rename from theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt rename to theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmark.kt index 45802ec8b715396bb21fd7d3b8281176b7c2284a..487b583188e8e5741900615108e2b2fa913353df 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmark.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmark.kt @@ -1,5 +1,7 @@ -package theodolite.benchmark +package theodolite +import theodolite.benchmark.Benchmark +import theodolite.benchmark.BenchmarkDeployment import theodolite.util.LoadDimension import theodolite.util.ConfigurationOverride import theodolite.util.Resource diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt similarity index 64% rename from theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt rename to theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt index 8c86fe3175ca46147ce610c654bd118f31e566e1..c59e8b4e1d01cc28bfc8a1fb508930ee408571ee 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestBenchmarkDeployment.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkDeployment.kt @@ -1,4 +1,6 @@ -package theodolite.benchmark +package theodolite + +import theodolite.benchmark.BenchmarkDeployment class TestBenchmarkDeployment: BenchmarkDeployment { override fun setup() { diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt similarity index 90% rename from theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt rename to theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt index 00afeb18dc7fff4bd50db4b77f514fc13e1e7771..e6a6f672ab5440bf5e4cc9a1dbfa01ab36fcc410 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TestBenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/TestBenchmarkExecutorImpl.kt @@ -1,6 +1,7 @@ -package theodolite.execution +package theodolite import theodolite.benchmark.Benchmark +import theodolite.execution.BenchmarkExecutor import theodolite.util.LoadDimension import theodolite.util.Resource import theodolite.util.Results