Skip to content
Snippets Groups Projects
Commit 314a8f7e authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'Kotlin-Warning-Fixes' into 'main'

Partially fixed IntelliJ warnings (#361)

See merge request !276
parents 2fc0690f f4e1f01a
No related branches found
No related tags found
1 merge request!276Partially fixed IntelliJ warnings (#361)
Pipeline #9087 passed
...@@ -195,9 +195,9 @@ class BenchmarkStateChecker( ...@@ -195,9 +195,9 @@ class BenchmarkStateChecker(
} }
private fun <K, V> Map<K, V>.containsMatchLabels(matchLabels: Map<V, V>): Boolean { private fun <K, V> Map<K, V>.containsMatchLabels(matchLabels: Map<K, V>): Boolean {
for (kv in matchLabels) { for (kv in matchLabels) {
if (kv.value != this[kv.key as K]) { if (kv.value != this[kv.key]) {
return false return false
} }
} }
......
...@@ -34,7 +34,7 @@ class ExecutionEventHandler( ...@@ -34,7 +34,7 @@ class ExecutionEventHandler(
override fun onAdd(execution: ExecutionCRD) { override fun onAdd(execution: ExecutionCRD) {
logger.info { "Add execution ${execution.metadata.name}." } logger.info { "Add execution ${execution.metadata.name}." }
execution.spec.name = execution.metadata.name execution.spec.name = execution.metadata.name
when (this.stateHandler.getExecutionState(execution.metadata.name)) { when (val currentState = this.stateHandler.getExecutionState(execution.metadata.name)) {
ExecutionState.NO_STATE -> this.stateHandler.setExecutionState(execution.spec.name, ExecutionState.PENDING) ExecutionState.NO_STATE -> this.stateHandler.setExecutionState(execution.spec.name, ExecutionState.PENDING)
ExecutionState.RUNNING -> { ExecutionState.RUNNING -> {
this.stateHandler.setExecutionState(execution.spec.name, ExecutionState.RESTART) this.stateHandler.setExecutionState(execution.spec.name, ExecutionState.RESTART)
...@@ -42,6 +42,9 @@ class ExecutionEventHandler( ...@@ -42,6 +42,9 @@ class ExecutionEventHandler(
this.controller.stop(restart = true) this.controller.stop(restart = true)
} }
} }
else -> {
logger.info { "ExecutionState '$currentState' is not handled." }
}
} }
} }
......
...@@ -136,7 +136,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) { ...@@ -136,7 +136,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) {
ExecutionCRD, ExecutionCRD,
BenchmarkExecutionList, BenchmarkExecutionList,
Resource<ExecutionCRD>> { Resource<ExecutionCRD>> {
return this.client.customResources( return client.resources(
ExecutionCRD::class.java, ExecutionCRD::class.java,
BenchmarkExecutionList::class.java BenchmarkExecutionList::class.java
) )
...@@ -146,7 +146,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) { ...@@ -146,7 +146,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) {
BenchmarkCRD, BenchmarkCRD,
KubernetesBenchmarkList, KubernetesBenchmarkList,
Resource<BenchmarkCRD>> { Resource<BenchmarkCRD>> {
return this.client.customResources( return client.resources(
BenchmarkCRD::class.java, BenchmarkCRD::class.java,
KubernetesBenchmarkList::class.java KubernetesBenchmarkList::class.java
) )
......
...@@ -27,4 +27,4 @@ abstract class AbstractPatcher : Patcher { ...@@ -27,4 +27,4 @@ abstract class AbstractPatcher : Patcher {
abstract fun patchSingleResource(resource: HasMetadata, value: String): HasMetadata abstract fun patchSingleResource(resource: HasMetadata, value: String): HasMetadata
} }
\ No newline at end of file
...@@ -31,8 +31,8 @@ data class PrometheusResponse( ...@@ -31,8 +31,8 @@ data class PrometheusResponse(
for (value in values) { for (value in values) {
val valueList = value as List<*> val valueList = value as List<*>
val timestamp = (valueList[0] as Double).toLong().toString() val timestamp = (valueList[0] as Double).toLong().toString()
val value = valueList[1].toString() val resultValue = valueList[1].toString()
result.add(listOf(group, timestamp, value)) result.add(listOf(group, timestamp, resultValue))
} }
} }
return Collections.unmodifiableList(result) return Collections.unmodifiableList(result)
......
...@@ -62,7 +62,6 @@ internal class ResultsTest { ...@@ -62,7 +62,6 @@ internal class ResultsTest {
assertEquals(20000, maxRequiredInstances) assertEquals(20000, maxRequiredInstances)
} }
@Test @Test
fun testGetMaxBenchmarkedLoadWhenAllSuccessfulCapacity() { fun testGetMaxBenchmarkedLoadWhenAllSuccessfulCapacity() {
val results = Results(Metric.from("capacity")) val results = Results(Metric.from("capacity"))
......
...@@ -113,6 +113,7 @@ class ControllerTest { ...@@ -113,6 +113,7 @@ class ControllerTest {
.getDeclaredMethod("getBenchmarks") .getDeclaredMethod("getBenchmarks")
method.isAccessible = true method.isAccessible = true
@Suppress("UNCHECKED_CAST")
val result = method.invoke(controller) as List<BenchmarkCRD> val result = method.invoke(controller) as List<BenchmarkCRD>
assertEquals(2, result.size) assertEquals(2, result.size)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment