Skip to content

Commit

Permalink
Execute ping-pong demo in single trust zone and federation integratio…
Browse files Browse the repository at this point in the history
…n tests
  • Loading branch information
markgoddard committed Nov 13, 2024
1 parent ae71e4d commit 7f6a030
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
22 changes: 20 additions & 2 deletions tests/integration/federation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TRUST_DOMAIN_1=${TRUST_DOMAIN_1:-td1}
TRUST_ZONE_2=${TRUST_ZONE_2:-tz2}
TRUST_DOMAIN_2=${TRUST_DOMAIN_2:-td2}

NAMESPACE_POLICY_NAMESPACE=${NAMESPACE_POLICY_NAMESPACE:-ns1}
NAMESPACE_POLICY_NAMESPACE=${NAMESPACE_POLICY_NAMESPACE:-demo}
POD_POLICY_POD_LABEL=${POD_POLICY_POD_LABEL:-"foo=bar"}

function configure() {
Expand Down Expand Up @@ -57,7 +57,25 @@ function show_status() {
}

function run_tests() {
echo "TODO!"
just -f demos/Justfile deploy-ping-pong $K8S_CLUSTER_1_CONTEXT $K8S_CLUSTER_2_CONTEXT
if ! wait_for_pong; then
echo "Timed out waiting for pong from server"
echo "Client logs:"
kubectl --context $K8S_CLUSTER_1_CONTEXT logs -n demo deployments/ping-pong-client
echo "Server logs:"
kubectl --context $K8S_CLUSTER_2_CONTEXT logs -n demo deployments/ping-pong-server
exit 1
fi
}

function wait_for_pong() {
kubectl --context $K8S_CLUSTER_1_CONTEXT wait -n demo --for=condition=Available --timeout 60s deployments/ping-pong-client
for i in $(seq 30); do
if kubectl --context $K8S_CLUSTER_1_CONTEXT logs -n demo deployments/ping-pong-client | grep pong; then
return
fi
sleep 2
done
}

function down() {
Expand Down
22 changes: 20 additions & 2 deletions tests/integration/single-trust-zone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ K8S_CLUSTER_CONTEXT=${K8S_CLUSTER_CONTEXT:-kind-$K8S_CLUSTER_NAME}
TRUST_ZONE=${TRUST_ZONE:-tz1}
TRUST_DOMAIN=${TRUST_DOMAIN:-td1}

NAMESPACE_POLICY_NAMESPACE=${NAMESPACE_POLICY_NAMESPACE:-ns1}
NAMESPACE_POLICY_NAMESPACE=${NAMESPACE_POLICY_NAMESPACE:-demo}
POD_POLICY_POD_LABEL=${POD_POLICY_POD_LABEL:-"foo=bar"}

function configure() {
Expand Down Expand Up @@ -45,7 +45,25 @@ function show_status() {
}

function run_tests() {
echo "TODO!"
just -f demos/Justfile deploy-ping-pong $K8S_CLUSTER_CONTEXT
if ! wait_for_pong; then
echo "Timed out waiting for pong from server"
echo "Client logs:"
kubectl --context $K8S_CLUSTER_CONTEXT logs -n demo deployments/ping-pong-client
echo "Server logs:"
kubectl --context $K8S_CLUSTER_CONTEXT logs -n demo deployments/ping-pong-server
exit 1
fi
}

function wait_for_pong() {
kubectl --context $K8S_CLUSTER_CONTEXT wait -n demo --for=condition=Available --timeout 60s deployments/ping-pong-client
for i in $(seq 30); do
if kubectl --context $K8S_CLUSTER_CONTEXT logs -n demo deployments/ping-pong-client | grep pong; then
return
fi
sleep 2
done
}

function down() {
Expand Down

0 comments on commit 7f6a030

Please sign in to comment.