Skip to content

Commit

Permalink
test/e2e: add initial config error propagation test.
Browse files Browse the repository at this point in the history
Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Nov 22, 2024
1 parent 9af0f6f commit 2a95248
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"

Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: config.nri/v1alpha1
kind: TopologyAwarePolicy
metadata:
name: default
name: ${CONFIG_NAME:-default}
namespace: kube-system
spec:
pinCPU: true
Expand Down

0 comments on commit 2a95248

Please sign in to comment.