Skip to content

Commit a449edd

Browse files
committed
Wait loops
1 parent 4a90c85 commit a449edd

File tree

2 files changed

+86
-10
lines changed

2 files changed

+86
-10
lines changed

http-tests/admin/packages/install-uninstall-package-stylesheet.sh

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ curl -k -w "%{http_code}\n" -o /dev/null -f -s \
1919
"${ADMIN_BASE_URL}packages/install" \
2020
| grep -q "$STATUS_SEE_OTHER"
2121

22+
# Wait for package installation to complete (poll for stylesheet availability)
23+
max_wait=30 # maximum seconds to wait
24+
wait_interval=0.5 # check every 0.5 seconds
25+
elapsed=0
26+
stylesheet_status=""
27+
28+
while [ $(echo "$elapsed < $max_wait" | bc) -eq 1 ]; do
29+
stylesheet_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
30+
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
31+
if [ "$stylesheet_status" = "200" ]; then
32+
echo "Package stylesheet available after ${elapsed}s (status: $stylesheet_status)"
33+
break
34+
fi
35+
sleep $wait_interval
36+
elapsed=$(echo "$elapsed + $wait_interval" | bc)
37+
done
38+
39+
if [ "$stylesheet_status" != "200" ]; then
40+
echo "ERROR: Package stylesheet not available after ${elapsed}s (status: $stylesheet_status)"
41+
exit 1
42+
fi
43+
2244
# verify package stylesheet was installed (should return 200)
2345
curl -k -f -s -o /dev/null \
2446
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl"
@@ -36,11 +58,27 @@ curl -k -w "%{http_code}\n" -o /dev/null -f -s \
3658
"${ADMIN_BASE_URL}packages/uninstall" \
3759
| grep -q "$STATUS_SEE_OTHER"
3860

39-
# Wait for Tomcat's static resource cache to expire
40-
# Tomcat caches static files with default cacheTtl=5000ms (5 seconds)
41-
# See: https://tomcat.apache.org/tomcat-10.1-doc/config/resources.html#Attributes
42-
default_ttl=5
43-
sleep $default_ttl
61+
# Wait for package uninstallation to complete (poll for stylesheet removal)
62+
max_wait=30 # maximum seconds to wait
63+
wait_interval=0.5 # check every 0.5 seconds
64+
elapsed=0
65+
stylesheet_status=""
66+
67+
while [ $(echo "$elapsed < $max_wait" | bc) -eq 1 ]; do
68+
stylesheet_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
69+
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
70+
if [ "$stylesheet_status" = "404" ]; then
71+
echo "Package stylesheet removed after ${elapsed}s (status: $stylesheet_status)"
72+
break
73+
fi
74+
sleep $wait_interval
75+
elapsed=$(echo "$elapsed + $wait_interval" | bc)
76+
done
77+
78+
if [ "$stylesheet_status" != "404" ]; then
79+
echo "ERROR: Package stylesheet not removed after ${elapsed}s (status: $stylesheet_status)"
80+
exit 1
81+
fi
4482

4583
# verify package stylesheet was deleted (should return 404)
4684
curl -k -w "%{http_code}\n" -o /dev/null -s \

http-tests/admin/packages/uninstall-package-stylesheet.sh

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ curl -k -w "%{http_code}\n" -o /dev/null -f -s \
1919
"${ADMIN_BASE_URL}packages/install" \
2020
| grep -q "$STATUS_SEE_OTHER"
2121

22+
# Wait for package installation to complete (poll for stylesheet availability)
23+
max_wait=30 # maximum seconds to wait
24+
wait_interval=0.5 # check every 0.5 seconds
25+
elapsed=0
26+
stylesheet_status=""
27+
28+
while [ $(echo "$elapsed < $max_wait" | bc) -eq 1 ]; do
29+
stylesheet_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
30+
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
31+
if [ "$stylesheet_status" = "200" ]; then
32+
echo "Package stylesheet available after ${elapsed}s (status: $stylesheet_status)"
33+
break
34+
fi
35+
sleep $wait_interval
36+
elapsed=$(echo "$elapsed + $wait_interval" | bc)
37+
done
38+
39+
if [ "$stylesheet_status" != "200" ]; then
40+
echo "ERROR: Package stylesheet not available after ${elapsed}s (status: $stylesheet_status)"
41+
exit 1
42+
fi
43+
2244
# verify package stylesheet exists before uninstall (should return 200)
2345
curl -k -f -s -o /dev/null \
2446
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl"
@@ -32,11 +54,27 @@ curl -k -w "%{http_code}\n" -o /dev/null -f -s \
3254
"${ADMIN_BASE_URL}packages/uninstall" \
3355
| grep -q "$STATUS_SEE_OTHER"
3456

35-
# Wait for Tomcat's static resource cache to expire
36-
# Tomcat caches static files with default cacheTtl=5000ms (5 seconds)
37-
# See: https://tomcat.apache.org/tomcat-10.1-doc/config/resources.html#Attributes
38-
default_ttl=5
39-
sleep $default_ttl
57+
# Wait for package uninstallation to complete (poll for stylesheet removal)
58+
max_wait=30 # maximum seconds to wait
59+
wait_interval=0.5 # check every 0.5 seconds
60+
elapsed=0
61+
stylesheet_status=""
62+
63+
while [ $(echo "$elapsed < $max_wait" | bc) -eq 1 ]; do
64+
stylesheet_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
65+
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
66+
if [ "$stylesheet_status" = "404" ]; then
67+
echo "Package stylesheet removed after ${elapsed}s (status: $stylesheet_status)"
68+
break
69+
fi
70+
sleep $wait_interval
71+
elapsed=$(echo "$elapsed + $wait_interval" | bc)
72+
done
73+
74+
if [ "$stylesheet_status" != "404" ]; then
75+
echo "ERROR: Package stylesheet not removed after ${elapsed}s (status: $stylesheet_status)"
76+
exit 1
77+
fi
4078

4179
# verify package stylesheet was deleted (should return 404)
4280
curl -k -w "%{http_code}\n" -o /dev/null -s \

0 commit comments

Comments
 (0)