diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/Action.kt b/theodolite/src/main/kotlin/theodolite/benchmark/Action.kt index 35efebdc0fb2a3748660cb76cdd5499b4ca5f622..8bd16d04d6a5e5ef3f362ff7d5611bf73e367a7e 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/Action.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/Action.kt @@ -23,7 +23,7 @@ class Action { timeout = exec.timeoutSeconds, command = exec.command ) - if(exitCode != 0){ + if (exitCode != 0){ throw ActionCommandFailedException("Error while executing action, finished with exit code $exitCode") } } @@ -38,7 +38,7 @@ class ActionSelector { @JsonDeserialize @RegisterForReflection class PodSelector { - lateinit var matchLabels: MutableMap<String, String> + lateinit var matchLabels: Map<String, String> } @JsonDeserialize @RegisterForReflection diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt index a4345c43ac6a75667c3c3e85c8534697193e1458..9f0578f7d1456d823a29049daae6dbe886c95e2a 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt @@ -33,7 +33,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) { * @return the exit code of this executed command */ fun exec( - matchLabels: MutableMap<String, String>, + matchLabels: Map<String, String>, command: Array<String>, timeout: Long = Configuration.TIMEOUT_SECONDS, container: String = "" @@ -58,7 +58,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) { val latchTerminationStatus = execLatch.await(timeout, TimeUnit.SECONDS) if (!latchTerminationStatus) { - throw ActionCommandFailedException("Latch could not terminate within specified time") + throw ActionCommandFailedException("Timeout while running action command") } execWatch.close() } catch (e: Exception) { @@ -112,7 +112,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) { * it can take a while until the status is ready and the pod can be selected. * @return the name of the pod or throws [ActionCommandFailedException] */ - fun getPodName(matchLabels: MutableMap<String, String>, tries: Int): String { + fun getPodName(matchLabels: Map<String, String>, tries: Int): String { for (i in 1..tries) { try { @@ -125,7 +125,7 @@ class ActionCommand(val client: NamespacedKubernetesClient) { throw ActionCommandFailedException("Couldn't find any pod that matches the specified labels.") } - private fun getPodName(matchLabels: MutableMap<String, String>): String { + private fun getPodName(matchLabels: Map<String, String>): String { return try { val podNames = this.client .pods() diff --git a/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt b/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt index 6dcfb582655ff9295aedd63d8c30cbac7daae2b3..c20b2ba87e386dc7c0a14245e03bedfb067720e6 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/operator/BenchmarkStateChecker.kt @@ -190,7 +190,7 @@ class BenchmarkStateChecker( } } -private fun <K, V> MutableMap<K, V>.containsMatchLabels(matchLabels: MutableMap<V, V>): Boolean { +private fun <K, V> Map<K, V>.containsMatchLabels(matchLabels: Map<V, V>): Boolean { for (kv in matchLabels) { if (kv.value != this[kv.key as K]) { return false diff --git a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt index 0e40fca5caf9fe721c547e09d2ba22c25860a1bf..47f0e52f45e46e3cda093ff1b9722071f22ef7e8 100644 --- a/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt +++ b/theodolite/src/test/kotlin/theodolite/benchmark/ActionCommandTest.kt @@ -102,7 +102,7 @@ class ActionCommandTest { val action = Action() action.selector = ActionSelector() action.selector.pod = PodSelector() - action.selector.pod.matchLabels = mutableMapOf("app" to "pod") + action.selector.pod.matchLabels = mapOf("app" to "pod") action.exec = Command() action.exec.command = arrayOf("ls") action.exec.timeoutSeconds = 10L @@ -118,7 +118,7 @@ class ActionCommandTest { val action = Action() action.selector = ActionSelector() action.selector.pod = PodSelector() - action.selector.pod.matchLabels = mutableMapOf("app" to "pod") + action.selector.pod.matchLabels = mapOf("app" to "pod") action.exec = Command() action.exec.command = arrayOf("error-command") action.exec.timeoutSeconds = 10L