Skip to content

Commit

Permalink
Avoid prompting for namespace creation in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markgoddard committed Nov 13, 2024
1 parent 1799289 commit 31303c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
18 changes: 11 additions & 7 deletions demos/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set shell := ["bash", "-euo", "pipefail", "-c"]

namespace := "demo"

# Set prompt_namespace=no to avoid prompting before namespace creation.
prompt_namespace := 'yes'

# Check for demo script dependencies
check-deps:
for cmd in ko kubectl; do \
Expand All @@ -17,13 +20,14 @@ ensure-namespace context:
if [[ ! -z "{{context}}" ]]; then \
if ! kubectl --context {{context}} get namespace "{{namespace}}" &> /dev/null; then \
echo "Namespace {{namespace}} does not exist"; \
read -p "Create namespace? (y/n) " -r; \
if [[ $REPLY =~ ^[Yy]$ ]]; then \
kubectl --context {{context}} create namespace "{{namespace}}"; \
else \
echo "Aborting..."; \
exit 1; \
fi \
if [[ "{{prompt_namespace}}" != "no" ]]; then \
read -p "Create namespace? (y/n) " -r; \
if [[ ! $REPLY =~ ^[Yy]$ ]]; then \
echo "Aborting..."; \
exit 1; \
fi \
fi; \
kubectl --context {{context}} create namespace "{{namespace}}"; \
fi \
fi

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/federation/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function show_status() {
}

function run_tests() {
just -f demos/Justfile deploy-ping-pong $K8S_CLUSTER_1_CONTEXT $K8S_CLUSTER_2_CONTEXT
just -f demos/Justfile prompt_namespace=no 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:"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/single-trust-zone/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function show_status() {
}

function run_tests() {
just -f demos/Justfile deploy-ping-pong $K8S_CLUSTER_CONTEXT
just -f demos/Justfile prompt_namespace=no deploy-ping-pong $K8S_CLUSTER_CONTEXT
if ! wait_for_pong; then
echo "Timed out waiting for pong from server"
echo "Client logs:"
Expand Down

0 comments on commit 31303c1

Please sign in to comment.