diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt index 9b27dd44d49c91f16317c6742c4189eaf6d2a770..90b1362659b54eaa0452fdc364e4fcb408a9151f 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt @@ -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) diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt index 12f7c68965ee3f10efcfe4a887db9344851996b6..1e947ed81c2356036d94902da4cd5b7c81154551 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt @@ -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) diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt index 5dc2764d86d543a94eee7966b3870eeedff1f4b3..1c3f37ac3f5e02e3f5f0b251c46ce17acb2fe5a7 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt @@ -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)