From a441a0f2d9626ef46bccbbea2aff54505a0fe2a7 Mon Sep 17 00:00:00 2001 From: Krisztian Litkey <krisztian.litkey@intel.com> Date: Fri, 22 Nov 2024 15:19:14 +0200 Subject: [PATCH] test/e2e: add initial config error propagation test. Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com> --- .../n4c16/test12-config-status/code.var.sh | 28 ++++++++++++++++++- .../custom-config.yaml.in | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/code.var.sh b/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/code.var.sh index 644001707..c8472e046 100644 --- a/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/code.var.sh +++ b/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/code.var.sh @@ -1,4 +1,13 @@ -helm-terminate +CONFIG_GROUP="group.test" + +cleanup() { + vm-command "kubectl delete -n kube-system topologyawarepolicies.config.nri/default" || : + vm-command "kubectl delete -n kube-system topologyawarepolicies.config.nri/$CONFIG_GROUP" || : + vm-command "kubectl label nodes --all config.nri/group-" || : + helm-terminate || : +} + +cleanup helm_config=$(instantiate helm-config.yaml) helm-launch topology-aware sleep 1 @@ -12,6 +21,7 @@ vm-command "kubectl wait -n kube-system topologyawarepolicies/default \ error "expected initial Success status" } +# verify propagation of errors back to source CR vm-put-file $(RESERVED_CPU=750x instantiate custom-config.yaml) broken-config.yaml vm-command "kubectl apply -f broken-config.yaml" @@ -26,3 +36,19 @@ vm-command "kubectl wait -n kube-system topologyawarepolicies/default \ } helm-terminate + +# verify propagation of initial configuration errors back to source CR +vm-put-file $(CONFIG_NAME="$CONFIG_GROUP" RESERVED_CPU=750x instantiate custom-config.yaml) \ + broken-group-config.yaml +vm-command "kubectl apply -f broken-group-config.yaml" || \ + error "failed to install broken group config" +vm-command "kubectl label nodes --all config.nri/group=test" || \ + error "failed to label nodes for group config" + +expect_error=1 launch_timeout=5s helm_config=$(instantiate helm-config.yaml) helm-launch topology-aware +get-config-node-status-error topologyawarepolicies/$CONFIG_GROUP | \ + grep "failed to parse" | grep -q 750x || { + error "expected initial error not found in status" +} + +cleanup diff --git a/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/custom-config.yaml.in b/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/custom-config.yaml.in index 720ef00d4..4a5f812de 100644 --- a/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/custom-config.yaml.in +++ b/test/e2e/policies.test-suite/topology-aware/n4c16/test12-config-status/custom-config.yaml.in @@ -1,7 +1,7 @@ apiVersion: config.nri/v1alpha1 kind: TopologyAwarePolicy metadata: - name: default + name: ${CONFIG_NAME:-default} namespace: kube-system spec: pinCPU: true