From 526f63303a9e816acd2cfc6f9477c230444abaed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20L=C3=B3pez?= Date: Fri, 30 Aug 2024 16:47:13 +0200 Subject: [PATCH] Improved test with service checking and browseability --- tests/test.bats | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/tests/test.bats b/tests/test.bats index a231687..082ec76 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -18,23 +18,57 @@ teardown() { [ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} } +check_services() { + echo "# Checking services:" >&3 + echo -n "# Checking if Aljibe is installed..." >&3 + ddev get --installed | grep "aljibe" | echo " Ok." >&3 + echo -n "# Checking if Aljibe Assistant is installed..." >&3 + ddev get --installed | grep "aljibe-assistant" | echo " Ok." >&3 + echo -n "# Checking if Adminer is installed..." >&3 + ddev get --installed | grep "adminer" | echo " Ok." >&3 + echo -n "# Checking if BackstopJS is installed..." >&3 + ddev get --installed | grep "backstopjs" | echo " Ok." >&3 + echo -n "# Checking if lighthouse is installed..." >&3 + ddev get --installed | grep "lighthouse" | echo " Ok." >&3 + echo -n "# Checking if mkdocs is installed..." >&3 + ddev get --installed | grep "mkdocs" | echo " Ok." >&3 + echo -n "# Checking if pa11y is installed..." >&3 + ddev get --installed | grep "pa11y" | echo " Ok." >&3 + echo -n "# Checking if redis is installed..." >&3 + ddev get --installed | grep "redis" | echo " Ok." >&3 + echo -n "# Checking if selenium is installed..." >&3 + ddev get --installed | grep "selenium" | echo " Ok." >&3 + echo -n "# Checking if unlighthouse is installed..." >&3 + ddev get --installed | grep "unlighthouse" | echo " Ok." >&3 +} + +# Check if the project is browsable with wget +check_project_browse() { + echo "# Checking if the project is browsable..." >&3 + wget -qO- https://${PROJNAME}.ddev.site | grep "Welcome!" +} + + @test "install from directory" { set -eu -o pipefail cd ${TESTDIR} echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 ddev get ${DIR} - ddev restart - + ddev restart >/dev/null ddev aljibe-assistant --auto + check_services + check_project_browse } @test "install from release" { set -eu -o pipefail cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) echo "# ddev get drud/ddev-addon-template with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 - ddev get drud/ddev-addon-template + ddev get metadrop/ddev-aljibe ddev restart >/dev/null - # Do something useful here that verifies the add-on - # ddev exec "curl -s elasticsearch:9200" | grep "${PROJNAME}-elasticsearch" + ddev aljibe-assistant --auto + + check_services + check_project_browse }