Skip to content

Commit

Permalink
feat: cofidectl workload status command added to each integration t…
Browse files Browse the repository at this point in the history
…est (#109)
  • Loading branch information
nialdaly authored Jan 2, 2025
1 parent a225c06 commit bde8446
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/integration/federation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ function post_deploy() {
fi
}

function show_workload_status() {
POD_NAME=$(kubectl get pods -l app=ping-pong-client \
-n $NAMESPACE_POLICY_NAMESPACE \
-o jsonpath='{.items[0].metadata.name}' \
--context $K8S_CLUSTER_1_CONTEXT)
WORKLOAD_STATUS_RESPONSE=$(./cofidectl workload status --namespace $NAMESPACE_POLICY_NAMESPACE \
--pod-name $POD_NAME \
--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() {
./cofidectl down
}
Expand All @@ -126,6 +144,7 @@ function main() {
show_status
run_tests
post_deploy
show_workload_status
down
echo "Success!"
}
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/single-trust-zone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@ function wait_for_pong() {
return 1
}

function show_workload_status() {
POD_NAME=$(kubectl get pods -l app=ping-pong-client \
-n $NAMESPACE_POLICY_NAMESPACE \
-o jsonpath='{.items[0].metadata.name}' \
--context $K8S_CLUSTER_CONTEXT)
WORKLOAD_STATUS_RESPONSE=$(./cofidectl workload status --namespace $NAMESPACE_POLICY_NAMESPACE \
--pod-name $POD_NAME \
--trust-zone $TRUST_ZONE)

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() {
./cofidectl down
}
Expand All @@ -92,6 +110,7 @@ function main() {
show_config
show_status
run_tests
show_workload_status
down
echo "Success!"
}
Expand Down

0 comments on commit bde8446

Please sign in to comment.