Skip to content
Snippets Groups Projects
Commit 0623f8a4 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

fix tests

parent 26e4beb5
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!148Make patcher parameters flexible,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -183,7 +183,7 @@ class TheodoliteController(
val configurationOverride = ConfigurationOverride()
configurationOverride.patcher = PatcherDefinition()
configurationOverride.patcher.type = "LabelPatcher"
configurationOverride.patcher.config = mapOf("variableName" to labelName)
configurationOverride.patcher.config = mutableMapOf("variableName" to labelName)
configurationOverride.patcher.resource = it
configurationOverride.value = labelValue
additionalConfigOverrides.add(configurationOverride)
......
......@@ -33,26 +33,18 @@ class ResourceLimitPatcherTest {
val defCPU = PatcherDefinition()
defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.type = "ResourceLimitPatcher"
defCPU.config =mutableListOf(
hashMapOf(
"key" to "limitedResource",
"value" to "cpu"),
hashMapOf(
"key" to "container",
"value" to "uc-application"
))
defCPU.config = mutableMapOf(
"limitedResource" to "cpu",
"container" to "application"
)
val defMEM = PatcherDefinition()
defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.type = "ResourceLimitPatcher"
defMEM.config =mutableListOf(
hashMapOf(
"key" to "limitedResource",
"value" to "memory"),
hashMapOf(
"key" to "container",
"value" to "uc-application"
))
defMEM.config = mutableMapOf(
"limitedResource" to "memory",
"container" to "uc-application"
)
patcherFactory.createPatcher(
patcherDefinition = defCPU,
......@@ -64,7 +56,7 @@ class ResourceLimitPatcherTest {
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.getValueByKey("container") }
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.config["container"] !! }
.forEach {
assertTrue(it.resources.limits["cpu"].toString() == cpuValue)
assertTrue(it.resources.limits["memory"].toString() == memValue)
......
......@@ -33,29 +33,17 @@ class ResourceRequestPatcherTest {
val defCPU = PatcherDefinition()
defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.type = "ResourceRequestPatcher"
defCPU.config = mutableListOf(
hashMapOf(
"key" to "requestedResource",
"value" to "cpu"
),
hashMapOf(
"key" to "container",
"value" to "uc-application"
)
defCPU.config = mutableMapOf(
"requestedResource" to "cpu",
"container" to "application"
)
val defMEM = PatcherDefinition()
defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.type = "ResourceRequestPatcher"
defMEM.config = mutableListOf(
hashMapOf(
"key" to "requestedResource",
"value" to "memory"
),
hashMapOf(
"key" to "container",
"value" to "uc-application"
)
defMEM.config = mutableMapOf(
"requestedResource" to "memory",
"container" to "application"
)
patcherFactory.createPatcher(
......@@ -67,7 +55,7 @@ class ResourceRequestPatcherTest {
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.getValueByKey("container") }
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.config["container"] !! }
.forEach {
assertTrue(it.resources.requests["cpu"].toString() == cpuValue)
assertTrue(it.resources.requests["memory"].toString() == memValue)
......
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