Skip to content

Commit

Permalink
Improved test with service checking and browseability
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjol committed Aug 30, 2024
1 parent b2ed829 commit 526f633
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 526f633

Please sign in to comment.