From a8b446f445b35adf5d164e7a171b0a79604de237 Mon Sep 17 00:00:00 2001 From: nialdaly Date: Thu, 2 Jan 2025 12:40:21 +0000 Subject: [PATCH] Simplified assertion to check that SVID verification message is logged --- tests/integration/federation/test.sh | 12 ++++++++++-- tests/integration/single-trust-zone/test.sh | 17 +---------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/tests/integration/federation/test.sh b/tests/integration/federation/test.sh index 0328f2d..b3b35d8 100755 --- a/tests/integration/federation/test.sh +++ b/tests/integration/federation/test.sh @@ -117,9 +117,17 @@ function show_workload_status() { -n $NAMESPACE_POLICY_NAMESPACE \ -o jsonpath='{.items[0].metadata.name}' \ --context $K8S_CLUSTER_1_CONTEXT) - ./cofidectl workload status --namespace $NAMESPACE_POLICY_NAMESPACE \ + WORKLOAD_STATUS_RESPONSE=$(./cofidectl workload status --namespace $NAMESPACE_POLICY_NAMESPACE \ --pod-name $POD_NAME \ - --trust-zone $TRUST_ZONE_1 + --trust-zone $TRUST_ZONE_1) + + if [[ ! $WORKLOAD_STATUS_RESPONSE == *"SVID verified against trust bundle"* ]]; then + echo "cofidectl workload status unsuccessful" + exit 1 + fi + + echo "cofidectl workload status successful" + exit 0 } function down() { diff --git a/tests/integration/single-trust-zone/test.sh b/tests/integration/single-trust-zone/test.sh index eabf46c..10e180b 100755 --- a/tests/integration/single-trust-zone/test.sh +++ b/tests/integration/single-trust-zone/test.sh @@ -89,22 +89,7 @@ function show_workload_status() { --pod-name $POD_NAME \ --trust-zone $TRUST_ZONE) - ERROR_PATTERNS=( - "Unable to create workload API client" - "unable to fetch X.509 trust bundles" - "unable to fetch X.509 SVIDs" - "SVID verification failed" - "No trust bundle found for trust domain" - ) - - for pattern in "${ERROR_PATTERNS[@]}"; do - if [[ $WORKLOAD_STATUS_RESPONSE == *"$pattern"* ]]; then - echo "cofidectl workload status unsuccessful" - exit 1 - fi - done - - if [[ ! $WORKLOAD_STATUS_RESPONSE == *"Trust bundles received"* ]] && [[ ! $WORKLOAD_STATUS_RESPONSE == *"SVIDs received"* ]]; then + if [[ ! $WORKLOAD_STATUS_RESPONSE == *"SVID verified against trust bundle"* ]]; then echo "cofidectl workload status unsuccessful" exit 1 fi