-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
8 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 |
---|---|---|
@@ -1,29 +1,45 @@ | ||
setup() { | ||
set -eu -o pipefail | ||
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." | ||
export TESTDIR=$(mktemp -d -t testsolr-XXXXXXXXXX) | ||
export PROJNAME=testsolr | ||
export TESTDIR=~/tmp/ddev-drupal9-solr-test | ||
mkdir -p $TESTDIR | ||
export PROJNAME=solrtest | ||
export DDEV_NON_INTERACTIVE=true | ||
ddev delete -Oy ${PROJNAME} || true | ||
cd "${TESTDIR}" | ||
ddev config --project-name=${PROJNAME} --project-type=drupal9 --docroot=web --create-docroot | ||
echo "# Setting up Drupal project via composer ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev composer create -y -n --no-install drupal/recommended-project | ||
ddev composer require -n --no-install drush/drush:* drupal/search_api_solr | ||
ddev composer install -n | ||
ddev composer config --append -- allow-plugins true | ||
ddev composer install | ||
ddev import-db --src=${DIR}/tests/testdata/db.sql.gz | ||
} | ||
|
||
teardown() { | ||
cd ${TESTDIR} | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
ddev delete -Oy ${DDEV_SITENAME} | ||
rm -rf ${TESTDIR} | ||
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} | ||
} | ||
|
||
@test "basic installation" { | ||
cd ${TESTDIR} | ||
@test "install from directory" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
echo "# ddev get drud/ddev-drupal9-solr with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get ${DIR} | ||
ddev restart | ||
status=$(ddev exec 'drush sapi-sl --format=json | jq -r .default_solr_server.status') | ||
[ "${status}" = "enabled" ] | ||
sleep 10 # After a restart, the solr server may not be ready yet. | ||
ddev drush search-api-solr:reload default_solr_server | ||
} | ||
|
||
@test "install from release" { | ||
set -eu -o pipefail | ||
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) | ||
echo "# ddev get drud/ddev-drupal9-solr with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 | ||
ddev get drud/ddev-drupal9-solr | ||
ddev restart | ||
status=$(ddev exec 'drush sapi-sl --format=json | jq -r .default_solr_server.status') | ||
[ "${status}" = "enabled" ] | ||
ddev drush search-api-solr:reload default_solr_server | ||
} |