Skip to content

Commit

Permalink
Improve tests and fix the version in ./VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jan 21, 2024
1 parent bbc9f59 commit 7088e1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ RUN curl -# -L -o phpldapadmin.tar.gz ${DIST_URL} && \
rm phpldapadmin.tar.gz && \
wget https://sources.debian.org/data/main/p/phpldapadmin/1.2.6.6-2/debian/patches/Fix-dynamic-property-PHP-8.2.patch && \
patch -p 1 -f < ./Fix-dynamic-property-PHP-8.2.patch && \
printf "RELEASE-${VERSION}" > ./VERSION && \
rm -vr ./doc/ ./.gitignore ./*.md

COPY <<-EOT /usr/local/share/sbom/phpldapadmin.spdx.json
Expand Down
10 changes: 10 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,27 @@ checkUrl() {

echo "Running tests..."

echo "Checking /"
checkUrl "http://${TEST_ADDR}/" -I
echo "Checking nginx status"
checkUrl "http://${TEST_ADDR}/.nginx/status" -I
echo "Checking phpfpm status"
checkUrl "http://${TEST_ADDR}/.phpfpm/status" -I
echo "Checking index"
checkUrl "http://${TEST_ADDR}/index.php" -I
echo "Checking robots.txt"
checkUrl "http://${TEST_ADDR}/robots.txt" -I
echo "Checking logo small"
checkUrl "http://${TEST_ADDR}/images/default/logo-small.png" -I | grep -F "Cache-Control: max-age=315360000"

echo "Checking version"
checkUrl "http://${TEST_ADDR}/index.php" | grep -q -F "1.2.6.7"

echo "Checking login"
checkUrl "http://${TEST_ADDR}/cmd.php" "form" "cmd=login&server_id=1&nodecode%5Blogin_pass%5D=1&login=cn%3Dadmin%2Cdc%3Dexample%2Cdc%3Dorg&login_pass=ldapadminpass&submit=Authenticate" | grep -q -F "Successfully logged into server."

if [ $DID_FAIL -gt 0 ]; then
echo "Some URLs failed"
exit 1
fi
echo "All tests PASS"

0 comments on commit 7088e1c

Please sign in to comment.