Skip to content
Snippets Groups Projects
Commit f4e1f01a authored by Christopher Konkel's avatar Christopher Konkel Committed by Sören Henning
Browse files

Partially fixed IntelliJ warnings (#361)

parent 2fc0690f
No related branches found
No related tags found
1 merge request!276Partially fixed IntelliJ warnings (#361)
......@@ -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) {
if (kv.value != this[kv.key as K]) {
if (kv.value != this[kv.key]) {
return false
}
}
......
......@@ -34,7 +34,7 @@ class ExecutionEventHandler(
override fun onAdd(execution: ExecutionCRD) {
logger.info { "Add execution ${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.RUNNING -> {
this.stateHandler.setExecutionState(execution.spec.name, ExecutionState.RESTART)
......@@ -42,6 +42,9 @@ class ExecutionEventHandler(
this.controller.stop(restart = true)
}
}
else -> {
logger.info { "ExecutionState '$currentState' is not handled." }
}
}
}
......
......@@ -136,7 +136,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) {
ExecutionCRD,
BenchmarkExecutionList,
Resource<ExecutionCRD>> {
return this.client.customResources(
return client.resources(
ExecutionCRD::class.java,
BenchmarkExecutionList::class.java
)
......@@ -146,7 +146,7 @@ class TheodoliteOperator(private val client: NamespacedKubernetesClient) {
BenchmarkCRD,
KubernetesBenchmarkList,
Resource<BenchmarkCRD>> {
return this.client.customResources(
return client.resources(
BenchmarkCRD::class.java,
KubernetesBenchmarkList::class.java
)
......
......@@ -27,4 +27,4 @@ abstract class AbstractPatcher : Patcher {
abstract fun patchSingleResource(resource: HasMetadata, value: String): HasMetadata
}
\ No newline at end of file
}
......@@ -31,8 +31,8 @@ data class PrometheusResponse(
for (value in values) {
val valueList = value as List<*>
val timestamp = (valueList[0] as Double).toLong().toString()
val value = valueList[1].toString()
result.add(listOf(group, timestamp, value))
val resultValue = valueList[1].toString()
result.add(listOf(group, timestamp, resultValue))
}
}
return Collections.unmodifiableList(result)
......
......@@ -62,7 +62,6 @@ internal class ResultsTest {
assertEquals(20000, maxRequiredInstances)
}
@Test
fun testGetMaxBenchmarkedLoadWhenAllSuccessfulCapacity() {
val results = Results(Metric.from("capacity"))
......
......@@ -113,6 +113,7 @@ class ControllerTest {
.getDeclaredMethod("getBenchmarks")
method.isAccessible = true
@Suppress("UNCHECKED_CAST")
val result = method.invoke(controller) as List<BenchmarkCRD>
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