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

Fix unresolved merge conflicts

parent ebe8fb40
No related branches found
No related tags found
1 merge request!217Use enums and duration in ExecutionStatus/BenchmarkStatus
Pipeline #6049 failed
...@@ -10,7 +10,7 @@ import theodolite.benchmark.ActionSelector ...@@ -10,7 +10,7 @@ import theodolite.benchmark.ActionSelector
import theodolite.benchmark.KubernetesBenchmark import theodolite.benchmark.KubernetesBenchmark
import theodolite.benchmark.ResourceSets import theodolite.benchmark.ResourceSets
import theodolite.model.crd.BenchmarkCRD import theodolite.model.crd.BenchmarkCRD
import theodolite.model.crd.BenchmarkStates import theodolite.model.crd.BenchmarkState
import theodolite.model.crd.KubernetesBenchmarkList import theodolite.model.crd.KubernetesBenchmarkList
class BenchmarkStateChecker( class BenchmarkStateChecker(
...@@ -42,7 +42,7 @@ class BenchmarkStateChecker( ...@@ -42,7 +42,7 @@ class BenchmarkStateChecker(
.forEach { setState(it.first, it.second) } .forEach { setState(it.first, it.second) }
} }
private fun setState(resource: BenchmarkCRD, state: BenchmarkStates) { private fun setState(resource: BenchmarkCRD, state: BenchmarkState) {
benchmarkStateHandler.setResourceSetState(resource.spec.name, state) benchmarkStateHandler.setResourceSetState(resource.spec.name, state)
} }
...@@ -52,13 +52,13 @@ class BenchmarkStateChecker( ...@@ -52,13 +52,13 @@ class BenchmarkStateChecker(
* @param benchmark The benchmark to check * @param benchmark The benchmark to check
* @return [BenchmarkStates.READY] iff all resource could be loaded and all actions could be executed, [BenchmarkStates.PENDING] else * @return [BenchmarkStates.READY] iff all resource could be loaded and all actions could be executed, [BenchmarkStates.PENDING] else
*/ */
private fun checkState(benchmark: KubernetesBenchmark): BenchmarkStates { private fun checkState(benchmark: KubernetesBenchmark): BenchmarkState {
return if (checkActionCommands(benchmark) == BenchmarkStates.READY return if (checkActionCommands(benchmark) == BenchmarkState.READY
&& checkResources(benchmark) == BenchmarkStates.READY && checkResources(benchmark) == BenchmarkState.READY
) { ) {
BenchmarkStates.READY BenchmarkState.READY
} else { } else {
BenchmarkStates.PENDING BenchmarkState.PENDING
} }
} }
...@@ -68,15 +68,15 @@ class BenchmarkStateChecker( ...@@ -68,15 +68,15 @@ class BenchmarkStateChecker(
* @param benchmark The benchmark to check * @param benchmark The benchmark to check
* @return The state of this benchmark. [BenchmarkStates.READY] if all actions could be executed, else [BenchmarkStates.PENDING] * @return The state of this benchmark. [BenchmarkStates.READY] if all actions could be executed, else [BenchmarkStates.PENDING]
*/ */
private fun checkActionCommands(benchmark: KubernetesBenchmark): BenchmarkStates { private fun checkActionCommands(benchmark: KubernetesBenchmark): BenchmarkState {
return if (checkIfActionPossible(benchmark.infrastructure.resources, benchmark.sut.beforeActions) return if (checkIfActionPossible(benchmark.infrastructure.resources, benchmark.sut.beforeActions)
&& checkIfActionPossible(benchmark.infrastructure.resources, benchmark.sut.afterActions) && checkIfActionPossible(benchmark.infrastructure.resources, benchmark.sut.afterActions)
&& checkIfActionPossible(benchmark.infrastructure.resources, benchmark.loadGenerator.beforeActions) && checkIfActionPossible(benchmark.infrastructure.resources, benchmark.loadGenerator.beforeActions)
&& checkIfActionPossible(benchmark.infrastructure.resources, benchmark.loadGenerator.beforeActions) && checkIfActionPossible(benchmark.infrastructure.resources, benchmark.loadGenerator.beforeActions)
) { ) {
BenchmarkStates.READY BenchmarkState.READY
} else { } else {
BenchmarkStates.PENDING BenchmarkState.PENDING
} }
} }
...@@ -171,21 +171,21 @@ class BenchmarkStateChecker( ...@@ -171,21 +171,21 @@ class BenchmarkStateChecker(
* Checks if it is possible to load all specified Kubernetes manifests. * Checks if it is possible to load all specified Kubernetes manifests.
* *
* @param benchmark The benchmark to check * @param benchmark The benchmark to check
* @return The state of this benchmark. [BenchmarkStates.READY] if all resources could be loaded, else [BenchmarkStates.PENDING] * @return The state of this benchmark. [BenchmarkState.READY] if all resources could be loaded, else [BenchmarkState.PENDING]
*/ */
fun checkResources(benchmark: KubernetesBenchmark): BenchmarkStates { fun checkResources(benchmark: KubernetesBenchmark): BenchmarkState {
return try { return try {
val appResources = val appResources =
benchmark.loadKubernetesResources(resourceSet = benchmark.sut.resources) benchmark.loadKubernetesResources(resourceSet = benchmark.sut.resources)
val loadGenResources = val loadGenResources =
benchmark.loadKubernetesResources(resourceSet = benchmark.loadGenerator.resources) benchmark.loadKubernetesResources(resourceSet = benchmark.loadGenerator.resources)
if (appResources.isNotEmpty() && loadGenResources.isNotEmpty()) { if (appResources.isNotEmpty() && loadGenResources.isNotEmpty()) {
BenchmarkStates.READY BenchmarkState.READY
} else { } else {
BenchmarkStates.PENDING BenchmarkState.PENDING
} }
} catch (e: Exception) { } catch (e: Exception) {
BenchmarkStates.PENDING BenchmarkState.PENDING
} }
} }
} }
......
...@@ -14,7 +14,7 @@ import org.junit.jupiter.api.BeforeEach ...@@ -14,7 +14,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.Assertions.*
import theodolite.benchmark.* import theodolite.benchmark.*
import theodolite.model.crd.BenchmarkStates import theodolite.model.crd.BenchmarkState
internal class BenchmarkStateCheckerTest { internal class BenchmarkStateCheckerTest {
private val server = KubernetesServer(false, false) private val server = KubernetesServer(false, false)
...@@ -172,6 +172,6 @@ internal class BenchmarkStateCheckerTest { ...@@ -172,6 +172,6 @@ internal class BenchmarkStateCheckerTest {
benchmark.getCR().spec.loadGenerator = resourceSet benchmark.getCR().spec.loadGenerator = resourceSet
benchmark.getCR().spec.sut = resourceSet benchmark.getCR().spec.sut = resourceSet
assertEquals(BenchmarkStates.READY,checkerCrud.checkResources(benchmark.getCR().spec)) assertEquals(BenchmarkState.READY,checkerCrud.checkResources(benchmark.getCR().spec))
} }
} }
\ No newline at end of file
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