From 42e61332096a527886e63e1d5be66511cb9cd19e Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Tue, 7 Feb 2023 13:24:02 +0100 Subject: [PATCH 1/8] fix test script --- .../examples/ldap-auth/{main.sh => test_ldap-auth-tutorial.sh} | 2 ++ 1 file changed, 2 insertions(+) rename modules/tutorials/examples/ldap-auth/{main.sh => test_ldap-auth-tutorial.sh} (92%) 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" From 65c8594356ae6d67a584d00e8b9856e14ee9d512 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Thu, 9 Feb 2023 10:07:48 +0100 Subject: [PATCH 2/8] fix: added some leniency sleep times to let resources appear --- modules/tutorials/examples/ldap-auth/20-verify-superset.sh | 3 +++ modules/tutorials/examples/ldap-auth/40-modify-superset.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index a69bc4cbd..39eeef275 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -4,6 +4,9 @@ shopt -s lastpipe source "./utils.sh" +# wait for superset resource to appear +sleep 3 + echo "Waiting for superset StatefulSet ..." kubectl rollout status --watch statefulset/superset-node-default diff --git a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh index 27d012bb7..4bf2fb41f 100755 --- a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh @@ -29,6 +29,9 @@ echo "Applying updated configuration" kubectl apply -f superset.yaml # end::apply-superset-cluster[] +# wait for superset resource to appear +sleep 3 + echo "Waiting for superset StatefulSet ..." kubectl rollout status --watch statefulset/superset-node-default From c58638ed2953737f8b4e1ea8555f015ac8d6f8e4 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Thu, 9 Feb 2023 14:34:38 +0100 Subject: [PATCH 3/8] better wait --- .../examples/ldap-auth/20-verify-superset.sh | 12 ++++++++++-- .../examples/ldap-auth/40-modify-superset.sh | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index 39eeef275..a7c5d93af 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -5,9 +5,17 @@ shopt -s lastpipe source "./utils.sh" # wait for superset resource to appear -sleep 3 +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 -echo "Waiting for superset StatefulSet ..." + sleep 1 +done + +echo "Waiting for superset StatefulSet to become ready ..." kubectl rollout status --watch statefulset/superset-node-default sleep 5 diff --git a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh index 4bf2fb41f..18ad5d6ef 100755 --- a/modules/tutorials/examples/ldap-auth/40-modify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/40-modify-superset.sh @@ -29,8 +29,15 @@ echo "Applying updated configuration" kubectl apply -f superset.yaml # end::apply-superset-cluster[] -# wait for superset resource to appear -sleep 3 +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 From 97ed7d8021adf08ca9be16b120ca02a0c24d875f Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Mon, 13 Mar 2023 11:24:24 +0100 Subject: [PATCH 4/8] longer wait --- modules/tutorials/examples/ldap-auth/20-verify-superset.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index a7c5d93af..fd78ed4a4 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -5,14 +5,14 @@ shopt -s lastpipe source "./utils.sh" # wait for superset resource to appear -for (( i=1; i<=15; i++ )) +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 1 + sleep 3 done echo "Waiting for superset StatefulSet to become ready ..." From f85811ab0c93e8610c5c6314db6fbc8961b41726 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Mon, 13 Mar 2023 11:24:56 +0100 Subject: [PATCH 5/8] Added timeout --- modules/tutorials/examples/ldap-auth/20-verify-superset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index fd78ed4a4..67106ac6e 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -16,7 +16,7 @@ do done echo "Waiting for superset StatefulSet to become ready ..." -kubectl rollout status --watch statefulset/superset-node-default +kubectl rollout status --watch --timeout=5m statefulset/superset-node-default sleep 5 From 95c32b6706aebe9d0fdf922fcc4beaf97c3a6bf8 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Mon, 13 Mar 2023 13:18:42 +0100 Subject: [PATCH 6/8] some changes --- modules/tutorials/examples/ldap-auth/20-verify-superset.sh | 4 ++++ modules/tutorials/examples/ldap-auth/utils.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index 67106ac6e..15c9ad5f3 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -20,6 +20,10 @@ 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" 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") From 1cce996a81c18286c2f3e3d56abb15cba17d3bcd Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Tue, 4 Apr 2023 11:50:15 +0200 Subject: [PATCH 7/8] test changes --- .../examples/ldap-auth/20-verify-superset.sh | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index 15c9ad5f3..b8da6e034 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -36,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" From 8b264ef5de3a73101ce3a0f3c20f4739f93afbb8 Mon Sep 17 00:00:00 2001 From: Felix Hennig Date: Tue, 4 Apr 2023 13:48:45 +0200 Subject: [PATCH 8/8] test changes --- modules/tutorials/examples/ldap-auth/20-verify-superset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh index b8da6e034..f27fdc2cd 100755 --- a/modules/tutorials/examples/ldap-auth/20-verify-superset.sh +++ b/modules/tutorials/examples/ldap-auth/20-verify-superset.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +set -uo pipefail shopt -s lastpipe source "./utils.sh"