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 e9790e3
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 "# Checking if Aljibe is installed" >&3
ddev get --installed | grep "aljibe"
echo "# Checking if Aljibe Assistant is installed" >&3
ddev get --installed | grep "aljibe-assistant"
echo "# Checking if Adminer is installed" >&3
ddev get --installed | grep "adminer"
echo "# Checking if BackstopJS is installed" >&3
ddev get --installed | grep "backstopjs"
echo "# Checking if lighthouse is installed" >&3
ddev get --installed | grep "lighthouse"
echo "# Checking if mkdocs is installed" >&3
ddev get --installed | grep "mkdocs"
echo "# Checking if pa11y is installed" >&3
ddev get --installed | grep "pa11y"
echo "# Checking if redis is installed" >&3
ddev get --installed | grep "redis"
echo "# Checking if selenium is installed" >&3
ddev get --installed | grep "selenium"
echo "# Checking if unlighthouse is installed" >&3
ddev get --installed | grep "unlighthouse"
}

# 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 e9790e3

Please sign in to comment.