diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index a69bc4cbd..f27fdc2cd 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -1,14 +1,29 @@ #!/usr/bin/env bash -set -euo pipefail +set -uo pipefail shopt -s lastpipe source "./utils.sh" -echo "Waiting for superset StatefulSet ..." -kubectl rollout status --watch statefulset/superset-node-default +# wait for superset resource to appear +for (( i=1; i<=30; i++ )) +do + echo "Waiting for superset StatefulSet to appear ..." + if eval kubectl get statefulset superset-node-default; then + break + fi + + sleep 3 +done + +echo "Waiting for superset StatefulSet to become ready ..." +kubectl rollout status --watch --timeout=5m statefulset/superset-node-default sleep 5 +echo "Stackable services:" + +stackablectl svc list + echo "Checking if login is working correctly ..." username="admin" @@ -21,6 +36,40 @@ else exit 1 fi +echo "11111111111111111111111111111111111111111" +sleep 300 + +if superset_login "db" "$username" "$password"; then + echo "Login successful with $username:$password" +else + echo "Login not successful. Exiting." + exit 1 +fi + +echo "2222222222222222222222222222222222222222222" +sleep 300 + +if superset_login "db" "$username" "$password"; then + echo "Login successful with $username:$password" +else + echo "Login not successful. Exiting." + exit 1 +fi + +echo "33333333333333333333333333333333" +sleep 300 + +if superset_login "db" "$username" "$password"; then + echo "Login successful with $username:$password" +else + echo "Login not successful. Exiting." + exit 1 +fi + +echo "FINISHED FINISHED FINISHED FINISHED" +sleep 30000 + + username="admin" password="wrongpassword" diff --git a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh index 27d012bb7..18ad5d6ef 100755 --- a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh @@ -29,6 +29,16 @@ echo "Applying updated configuration" kubectl apply -f superset.yaml # end::apply-superset-cluster[] +for (( i=1; i<=15; i++ )) +do + echo "Waiting for superset StatefulSet to appear ..." + if eval kubectl get statefulset superset-node-default; then + break + fi + + sleep 1 +done + echo "Waiting for superset StatefulSet ..." kubectl rollout status --watch statefulset/superset-node-default diff --git a/modules/tutorials/examples/ldap-auth/main.sh b/modules/tutorials/examples/ldap-auth/test_ldap-auth-tutorial.sh similarity index 92% rename from modules/tutorials/examples/ldap-auth/main.sh rename to modules/tutorials/examples/ldap-auth/test_ldap-auth-tutorial.sh index e8e6231fa..654e67303 100755 --- a/modules/tutorials/examples/ldap-auth/main.sh +++ b/modules/tutorials/examples/ldap-auth/test_ldap-auth-tutorial.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +cd "$(dirname "$0")" + for script in $(find . -name '[0-9][0-9]*sh' | sort) do printf "##########################################\n" diff --git a/modules/tutorials/examples/ldap-auth/utils.sh b/modules/tutorials/examples/ldap-auth/utils.sh index 70935913a..295d58fa4 100644 --- a/modules/tutorials/examples/ldap-auth/utils.sh +++ b/modules/tutorials/examples/ldap-auth/utils.sh @@ -14,6 +14,10 @@ superset_login() { json_header='Content-Type: application/json' + echo "Checking if Superset is reachable at $superset_addr" + return_code=$(curl --insecure -v -o /dev/null -w "%{http_code}" "$superset_addr") + echo "$return_code" + local response response=$(curl -Ls "$superset_endpoint" -H "$json_header" --data "$request_data")