generated from ddev/ddev-addon-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
4 changed files
with
68 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ddev-generated | ||
# If omit_containers[ddev-router] then this file will be replaced | ||
# with another with a `ports` statement to directly expose port 8080 to 9100 | ||
services: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,64 @@ | ||
setup() { | ||
mkcert -install >/dev/null | ||
set -eu -o pipefail | ||
brew_prefix=$(brew --prefix) | ||
load "${brew_prefix}/lib/bats-support/load.bash" | ||
load "${brew_prefix}/lib/bats-assert/load.bash" | ||
|
||
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." | ||
export TESTDIR=$(mktemp -d -t testadminer-XXXXXXXXXX) | ||
export PROJNAME=testadminer | ||
export TESTDIR=~/tmp/test-adminer | ||
mkdir -p $TESTDIR | ||
export PROJNAME=test-adminer | ||
export DDEV_NON_INTERACTIVE=true | ||
ddev delete -Oy ${PROJNAME} >/dev/null || true | ||
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true | ||
cd "${TESTDIR}" | ||
ddev config --project-name=${PROJNAME} | ||
echo ${PROJNAME} | ||
ddev start -y >/dev/null | ||
ddev start -y >/dev/null 2>&1 | ||
} | ||
|
||
health_checks() { | ||
set +u # bats-assert has unset variables so turn off unset check | ||
# ddev restart is required because we have done `ddev get` on a new service | ||
run ddev restart | ||
assert_success | ||
# Make sure we can hit the 9101 port successfully | ||
curl -s -I -f https://${PROJNAME}.ddev.site:9101 >/tmp/curlout.txt | ||
# Make sure `ddev adminer` works | ||
DDEV_DEBUG=true run ddev adminer | ||
assert_success | ||
assert_output --partial "FULLURL https://${PROJNAME}.ddev.site:9101" | ||
} | ||
|
||
teardown() { | ||
cd ${TESTDIR} | ||
ddev delete -Oy ${PROJNAME} || true | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 | ||
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} | ||
} | ||
|
||
@test "basic installation" { | ||
set -o pipefail | ||
cd ${TESTDIR} || ( printf "# unable to cd to ${TESTDIR}\n" >&3 && false ) | ||
@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 >/dev/null || (echo "# ddev restart returned exit code=%?" >&3 && false)) | ||
ddev help adminer | grep adminer >/dev/null | ||
ddev get ${DIR} >/dev/null 2>&1 | ||
ddev mutagen sync >/dev/null 2>&1 | ||
health_checks | ||
} | ||
|
||
@test "install from release" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
echo "# ddev get ddev/ddev-adminer with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get ddev/ddev-adminer >/dev/null 2>&1 | ||
ddev restart >/dev/null 2>&1 | ||
health_checks | ||
} | ||
|
||
# echo "# Trying curl -s -L -k https://${PROJNAME}.ddev.site:9101/" >&3 | ||
curl --fail -s -L -k https://${PROJNAME}.ddev.site:9101/ | grep 'document.querySelector.*auth.*db' >/dev/null | ||
@test "install from directory with nonstandard port" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} | ||
ddev config --router-http-port=8080 --router-https-port=8443 | ||
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get ${DIR} >/dev/null 2>&1 | ||
ddev mutagen sync >/dev/null 2>&1 | ||
health_checks | ||
} |