generated from ddev/ddev-addon-template
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated tests against drupal9, php, laravel platformsh templates, for
- Loading branch information
Showing
10 changed files
with
177 additions
and
50 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
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,30 @@ | ||
# Requires bats-assert and bats-support | ||
# brew tap kaos/shell && | ||
# brew install bats-core bats-assert bats-support jq mkcert yq | ||
setup() { | ||
load setup.sh | ||
} | ||
|
||
teardown() { | ||
load teardown.sh | ||
} | ||
|
||
@test "drupal9" { | ||
load per_test.sh | ||
template="drupal9" | ||
for source in $PROJECT_SOURCE platformsh/ddev-platformsh; do | ||
echo "# ddev get $source with template ${template} PROJNAME=${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
per_test_setup | ||
|
||
run ddev exec -s db 'echo ${DDEV_DATABASE}' | ||
assert_output "mariadb:10.4" | ||
run ddev exec "php --version | awk 'NR==1 { sub(/\.[0-9]+$/, \"\", \$2); print \$2 }'" | ||
assert_output "8.0" | ||
ddev describe -j >describe.json | ||
run jq -r .raw.docroot <describe.json | ||
assert_output "web" | ||
|
||
docker inspect ddev-${PROJNAME}-redis >/dev/null | ||
per_test_teardown | ||
done | ||
} |
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,29 @@ | ||
# Requires bats-assert and bats-support | ||
# brew tap kaos/shell && | ||
# brew install bats-core bats-assert bats-support jq mkcert yq | ||
setup() { | ||
load setup.sh | ||
load per_test.sh | ||
} | ||
|
||
teardown() { | ||
load teardown.sh | ||
} | ||
|
||
@test "laravel" { | ||
load per_test.sh | ||
template="laravel" | ||
for source in $PROJECT_SOURCE platformsh/ddev-platformsh; do | ||
echo "# doing ddev get $source with template ${template} PROJNAME=${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
per_test_setup | ||
|
||
run ddev exec "php --version | awk 'NR==1 { sub(/\.[0-9]+$/, \"\", \$2); print \$2 }'" | ||
assert_output "8.0" | ||
ddev describe -j >describe.json | ||
run jq -r .raw.docroot <describe.json | ||
assert_output "public" | ||
docker inspect ddev-${PROJNAME}-redis >/dev/null | ||
per_test_teardown | ||
|
||
done | ||
} |
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,20 @@ | ||
#!/bin/bash | ||
|
||
per_test_setup() { | ||
set -e -o pipefail | ||
set +u | ||
ddev delete -Oy ${PROJNAME} || true | ||
|
||
rm -rf ${TESTDIR} && mkdir -p ${TESTDIR} && cd ${TESTDIR} | ||
|
||
curl -sfL -o /tmp/testtemplate.tgz "https://github.com/platformsh-templates/${template}/tarball/master" | ||
tar -zxf /tmp/testtemplate.tgz --strip-components=1 | ||
# Start with bogus settings so we know we got the right stuff when testing | ||
ddev config --project-name=${PROJNAME} --php-version=5.6 --database=mariadb:10.1 --docroot=x --create-docroot --project-type=php --web-environment-add=PLATFORMSH_CLI_TOKEN=notokenrightnow,PLATFORM_PROJECT=notyet,PLATFORM_ENVIRONMENT=notyet | ||
ddev get ${PROJECT_SOURCE} | ||
ddev restart >/dev/null | ||
} | ||
|
||
per_test_teardown() { | ||
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true | ||
} |
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,28 @@ | ||
# Requires bats-assert and bats-support | ||
# brew tap kaos/shell && | ||
# brew install bats-core bats-assert bats-support jq mkcert yq | ||
setup() { | ||
load setup.sh | ||
load per_test.sh | ||
} | ||
|
||
teardown() { | ||
load teardown.sh | ||
} | ||
|
||
@test "php" { | ||
load per_test.sh | ||
template="php" | ||
for source in $PROJECT_SOURCE platformsh/ddev-platformsh; do | ||
echo "# doing ddev get $source with template ${template} PROJNAME=${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
per_test_setup | ||
|
||
run ddev exec "php --version | awk 'NR==1 { sub(/\.[0-9]+$/, \"\", \$2); print \$2 }'" | ||
assert_output "8.0" | ||
ddev describe -j >describe.json | ||
run jq -r .raw.docroot <describe.json | ||
assert_output "web" | ||
|
||
per_test_teardown | ||
done | ||
} |
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,12 @@ | ||
#!/bin/bash | ||
|
||
bats_require_minimum_version 1.8.0 | ||
set -eu -o pipefail | ||
export PROJECT_SOURCE="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." | ||
export TESTDIR=~/tmp/testplatformsh | ||
export PROJNAME=test-platformsh | ||
export DDEV_NON_INTERACTIVE=true | ||
brew_prefix=$(brew --prefix) | ||
docker volume rm $PROJNAME-mariadb 2>/dev/null || true | ||
load "${brew_prefix}/lib/bats-support/load.bash" | ||
load "${brew_prefix}/lib/bats-assert/load.bash" |
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,3 @@ | ||
|
||
set -eu -o pipefail | ||
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} |
This file was deleted.
Oops, something went wrong.