Skip to content

Commit 9384e34

Browse files
committed
Debug output for failing tests
1 parent d0bb33b commit 9384e34

4 files changed

Lines changed: 102 additions & 60 deletions

File tree

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

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,41 +13,53 @@ package_ontology_uri="https://raw.githubusercontent.com/AtomGraph/LinkedDataHub-
1313
namespace_ontology_uri="${END_USER_BASE_URL}ns#"
1414

1515
# install package
16-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
16+
echo "DEBUG: Installing package..." >&2
17+
install_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
1718
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
1819
-X POST \
1920
-H "Content-Type: application/x-www-form-urlencoded" \
2021
--data-urlencode "package-uri=$package_uri" \
21-
"$ADMIN_BASE_URL"packages/install \
22-
| grep -q "$STATUS_SEE_OTHER"
22+
"$ADMIN_BASE_URL"packages/install)
23+
echo "DEBUG: Install status: $install_status" >&2
24+
echo "$install_status" | grep -q "$STATUS_SEE_OTHER"
2325

2426
# verify owl:imports triple was added
25-
curl -k -s \
26-
-H "Accept: application/n-triples" \
27-
"${END_USER_BASE_URL}ns" \
28-
| grep -q "<${namespace_ontology_uri}> <http://www.w3.org/2002/07/owl#imports> <${package_ontology_uri}>"
27+
echo "DEBUG: Verifying owl:imports was added..." >&2
28+
ns_after_install=$(curl -k -s -H "Accept: application/n-triples" "${END_USER_BASE_URL}ns")
29+
echo "DEBUG: Namespace after install:" >&2
30+
echo "$ns_after_install" | grep "owl#imports" >&2
31+
echo "$ns_after_install" | grep -q "<${namespace_ontology_uri}> <http://www.w3.org/2002/07/owl#imports> <${package_ontology_uri}>"
2932

3033
# verify package ontology document exists
34+
echo "DEBUG: Verifying package ontology document exists..." >&2
3135
package_ontology_hash=$(echo -n "$package_ontology_uri" | shasum -a 1 | cut -d' ' -f1)
32-
curl -k -f -s -o /dev/null \
33-
"${ADMIN_BASE_URL}ontologies/${package_ontology_hash}/"
36+
ontology_doc_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${ADMIN_BASE_URL}ontologies/${package_ontology_hash}/")
37+
echo "DEBUG: Ontology document status: $ontology_doc_status" >&2
38+
echo "$ontology_doc_status" | grep -q "200"
3439

3540
# uninstall package
36-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
41+
echo "DEBUG: Uninstalling package..." >&2
42+
uninstall_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
3743
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
3844
-X POST \
3945
-H "Content-Type: application/x-www-form-urlencoded" \
4046
--data-urlencode "package-uri=$package_uri" \
41-
"$ADMIN_BASE_URL"packages/uninstall \
42-
| grep -q "$STATUS_SEE_OTHER"
47+
"$ADMIN_BASE_URL"packages/uninstall)
48+
echo "DEBUG: Uninstall status: $uninstall_status" >&2
49+
echo "$uninstall_status" | grep -q "$STATUS_SEE_OTHER"
4350

4451
# verify owl:imports triple was removed
52+
echo "DEBUG: Verifying owl:imports was removed..." >&2
4553
ns_after=$(curl -k -s -H "Accept: application/n-triples" "${END_USER_BASE_URL}ns")
54+
echo "DEBUG: Namespace after uninstall:" >&2
55+
echo "$ns_after" | grep "owl#imports" >&2 || echo "DEBUG: No owl:imports found (expected)" >&2
4656
if echo "$ns_after" | grep -q "<${namespace_ontology_uri}> <http://www.w3.org/2002/07/owl#imports> <${package_ontology_uri}>"; then
57+
echo "ERROR: Package ontology import still present after uninstall!" >&2
4758
exit 1
4859
fi
4960

5061
# verify package ontology document was deleted
51-
curl -k -w "%{http_code}\n" -o /dev/null -s \
52-
"${ADMIN_BASE_URL}ontologies/${package_ontology_hash}/" \
53-
| grep -q "$STATUS_FORBIDDEN"
62+
echo "DEBUG: Verifying package ontology document was deleted..." >&2
63+
deleted_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${ADMIN_BASE_URL}ontologies/${package_ontology_hash}/")
64+
echo "DEBUG: Deleted ontology document status: $deleted_status" >&2
65+
echo "$deleted_status" | grep -q "$STATUS_FORBIDDEN"

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

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,56 @@ purge_cache "$FRONTEND_VARNISH_SERVICE"
1111
package_uri="https://packages.linkeddatahub.com/skos/#this"
1212

1313
# install package
14-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
14+
echo "DEBUG: Installing package..." >&2
15+
install_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
1516
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
1617
-X POST \
1718
-H "Content-Type: application/x-www-form-urlencoded" \
1819
--data-urlencode "package-uri=$package_uri" \
19-
"$ADMIN_BASE_URL"packages/install \
20-
| grep -q "$STATUS_SEE_OTHER"
20+
"$ADMIN_BASE_URL"packages/install)
21+
echo "DEBUG: Install status: $install_status" >&2
22+
echo "$install_status" | grep -q "$STATUS_SEE_OTHER"
2123

2224
# verify package stylesheet was installed (should return 200)
23-
curl -k -f -s -o /dev/null \
24-
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl"
25+
echo "DEBUG: Verifying package stylesheet was installed..." >&2
26+
package_xsl_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
27+
echo "DEBUG: Package stylesheet status: $package_xsl_status" >&2
28+
echo "$package_xsl_status" | grep -q "200"
2529

2630
# verify master stylesheet includes package
27-
curl -k -s "$END_USER_BASE_URL"static/xsl/layout.xsl \
28-
| grep -q "com/linkeddatahub/packages/skos/layout.xsl"
31+
echo "DEBUG: Verifying master stylesheet includes package..." >&2
32+
master_xsl_before=$(curl -k -s "$END_USER_BASE_URL"static/xsl/layout.xsl)
33+
if echo "$master_xsl_before" | grep -q "com/linkeddatahub/packages/skos/layout.xsl"; then
34+
echo "DEBUG: Master stylesheet includes package (expected)" >&2
35+
else
36+
echo "ERROR: Master stylesheet does not include package after install!" >&2
37+
exit 1
38+
fi
2939

3040
# uninstall package
31-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
41+
echo "DEBUG: Uninstalling package..." >&2
42+
uninstall_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
3243
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
3344
-X POST \
3445
-H "Content-Type: application/x-www-form-urlencoded" \
3546
--data-urlencode "package-uri=$package_uri" \
36-
"$ADMIN_BASE_URL"packages/uninstall \
37-
| grep -q "$STATUS_SEE_OTHER"
47+
"$ADMIN_BASE_URL"packages/uninstall)
48+
echo "DEBUG: Uninstall status: $uninstall_status" >&2
49+
echo "$uninstall_status" | grep -q "$STATUS_SEE_OTHER"
3850

3951
# verify package stylesheet was deleted (should return 404)
40-
curl -k -w "%{http_code}\n" -o /dev/null -s \
41-
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl" \
42-
| grep -q "$STATUS_NOT_FOUND"
52+
echo "DEBUG: Verifying package stylesheet was deleted..." >&2
53+
deleted_xsl_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
54+
echo "DEBUG: Deleted package stylesheet status: $deleted_xsl_status" >&2
55+
echo "$deleted_xsl_status" | grep -q "$STATUS_NOT_FOUND"
4356

4457
# verify master stylesheet no longer includes package
58+
echo "DEBUG: Verifying master stylesheet no longer includes package..." >&2
4559
master_xsl=$(curl -k -s "$END_USER_BASE_URL"static/xsl/layout.xsl)
4660
if echo "$master_xsl" | grep -q "com/linkeddatahub/packages/skos/layout.xsl"; then
61+
echo "ERROR: Master stylesheet still includes package after uninstall!" >&2
62+
echo "DEBUG: Master stylesheet content:" >&2
63+
echo "$master_xsl" | grep -C 2 "com/linkeddatahub/packages/skos/layout.xsl" >&2
4764
exit 1
4865
fi
66+
echo "DEBUG: Master stylesheet does not include package (expected)" >&2

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

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,46 @@ purge_cache "$FRONTEND_VARNISH_SERVICE"
1111
package_uri="https://packages.linkeddatahub.com/skos/#this"
1212

1313
# first install the package
14-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
14+
echo "DEBUG: Installing package first..." >&2
15+
install_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
1516
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
1617
-X POST \
1718
-H "Content-Type: application/x-www-form-urlencoded" \
1819
--data-urlencode "package-uri=$package_uri" \
19-
"${ADMIN_BASE_URL}packages/install" \
20-
| grep -q "$STATUS_SEE_OTHER"
20+
"${ADMIN_BASE_URL}packages/install")
21+
echo "DEBUG: Install status: $install_status" >&2
22+
echo "$install_status" | grep -q "$STATUS_SEE_OTHER"
2123

2224
# verify package stylesheet exists before uninstall (should return 200)
23-
curl -k -f -s -o /dev/null \
24-
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl"
25+
echo "DEBUG: Verifying package stylesheet exists before uninstall..." >&2
26+
before_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
27+
echo "DEBUG: Package stylesheet status before uninstall: $before_status" >&2
28+
echo "$before_status" | grep -q "200"
2529

2630
# uninstall package via POST to packages/uninstall endpoint
27-
curl -k -w "%{http_code}\n" -o /dev/null -f -s \
31+
echo "DEBUG: Uninstalling package..." >&2
32+
uninstall_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s \
2833
-E "$OWNER_CERT_FILE":"$OWNER_CERT_PWD" \
2934
-X POST \
3035
-H "Content-Type: application/x-www-form-urlencoded" \
3136
--data-urlencode "package-uri=$package_uri" \
32-
"${ADMIN_BASE_URL}packages/uninstall" \
33-
| grep -q "$STATUS_SEE_OTHER"
37+
"${ADMIN_BASE_URL}packages/uninstall")
38+
echo "DEBUG: Uninstall status: $uninstall_status" >&2
39+
echo "$uninstall_status" | grep -q "$STATUS_SEE_OTHER"
3440

3541
# verify package stylesheet was deleted (should return 404)
36-
curl -k -w "%{http_code}\n" -o /dev/null -s \
37-
"${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl" \
38-
| grep -q "$STATUS_NOT_FOUND"
42+
echo "DEBUG: Verifying package stylesheet was deleted..." >&2
43+
deleted_status=$(curl -k -w "%{http_code}\n" -o /dev/null -s "${END_USER_BASE_URL}static/com/linkeddatahub/packages/skos/layout.xsl")
44+
echo "DEBUG: Deleted package stylesheet status: $deleted_status" >&2
45+
echo "$deleted_status" | grep -q "$STATUS_NOT_FOUND"
3946

4047
# verify master stylesheet was regenerated without package import
48+
echo "DEBUG: Verifying master stylesheet no longer includes package..." >&2
4149
master_xsl=$(curl -k -s "$END_USER_BASE_URL"static/xsl/layout.xsl)
4250
if echo "$master_xsl" | grep -q "com/linkeddatahub/packages/skos/layout.xsl"; then
51+
echo "ERROR: Master stylesheet still includes package after uninstall!" >&2
52+
echo "DEBUG: Master stylesheet content:" >&2
53+
echo "$master_xsl" | grep -C 2 "com/linkeddatahub/packages/skos/layout.xsl" >&2
4354
exit 1
4455
fi
56+
echo "DEBUG: Master stylesheet does not include package (expected)" >&2

http-tests/run.sh

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ function run_tests()
4545
echo -n "$script_pathname";
4646
script_filename=$(basename "$script_pathname")
4747
script_directory=$(dirname "$script_pathname")
48-
( cd "$script_directory" || exit;
49-
bash -e "$script_filename";
50-
)
51-
if [[ $? == "0" ]]
48+
local output=$(cd "$script_directory" || exit; bash -e "$script_filename" 2>&1)
49+
local exit_code=$?
50+
if [[ $exit_code == "0" ]]
5251
then
5352
echo " ok"
5453
else
5554
echo " failed";
55+
echo "$output"
5656
(( error_count += 1))
5757
fi
5858
done
@@ -138,24 +138,24 @@ download_dataset "$ADMIN_ENDPOINT_URL" > "$TMP_ADMIN_DATASET"
138138

139139
### Other tests ###
140140

141-
run_tests $(find ./add/ -type f -name '*.sh')
142-
(( error_count += $? ))
143-
run_tests $(find ./admin/ -type f -name '*.sh')
144-
(( error_count += $? ))
145-
run_tests $(find ./dataspaces/ -type f -name '*.sh')
146-
(( error_count += $? ))
147-
run_tests $(find ./access/ -type f -name '*.sh')
148-
(( error_count += $? ))
149-
run_tests $(find ./imports/ -type f -name '*.sh')
150-
(( error_count += $? ))
151-
run_tests $(find ./document-hierarchy/ -type f -name '*.sh')
152-
(( error_count += $? ))
153-
run_tests $(find ./misc/ -type f -name '*.sh')
154-
(( error_count += $? ))
155-
run_tests $(find ./proxy/ -type f -name '*.sh')
156-
(( error_count += $? ))
157-
run_tests $(find ./sparql-protocol/ -type f -name '*.sh')
141+
#run_tests $(find ./add/ -type f -name '*.sh')
142+
#(( error_count += $? ))
143+
run_tests $(find ./admin/packages -type f -name '*.sh')
158144
(( error_count += $? ))
145+
#run_tests $(find ./dataspaces/ -type f -name '*.sh')
146+
#(( error_count += $? ))
147+
#run_tests $(find ./access/ -type f -name '*.sh')
148+
#(( error_count += $? ))
149+
#run_tests $(find ./imports/ -type f -name '*.sh')
150+
#(( error_count += $? ))
151+
#run_tests $(find ./document-hierarchy/ -type f -name '*.sh')
152+
#(( error_count += $? ))
153+
#run_tests $(find ./misc/ -type f -name '*.sh')
154+
#(( error_count += $? ))
155+
#run_tests $(find ./proxy/ -type f -name '*.sh')
156+
#(( error_count += $? ))
157+
#run_tests $(find ./sparql-protocol/ -type f -name '*.sh')
158+
#(( error_count += $? ))
159159

160160
end_time=$(date +%s)
161161
runtime=$((end_time-start_time))

0 commit comments

Comments
 (0)