Skip to content

Commit

Permalink
Improve base tests and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Mar 18, 2022
1 parent c3cc384 commit b071da5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ A repository like this one is the way to get started. You can create a new repo
9. Test manually with `ddev get <owner/repo>`.
10. Update the README.md to describe the add-on, how to use it, and how to contribute. If there are any manual actions that have to be taken, please explain them. If it requires special configuration of the using project, please explain how to do those. Examples in [drud/ddev-drupal9-solr](https://github.com/drud/ddev-drupal9-solr), [drud/ddev-memcached](github.com/drud/ddev-memcached), and [drud/ddev-beanstalkd](https://github.com/drud/ddev-beanstalkd).
11. Add a good short description to your repo, and add the label "ddev-get". It will immediately be added to the list provided by `ddev get --list --all`.
12. When it has matured you may want to have it become an "official" maintained add-on. Open an issue in the ddev queue for that.
12. When it has matured you will hopefully want to have it become an "official" maintained add-on. Open an issue in the [ddev queue](https://github.com/drud/ddev/issues) for that.

**Contributed and maintained by [@CONTRIBUTOR](https://github.com/CONTRIBUTOR) based on the original [ddev-contrib recipe](https://github.com/drud/ddev-contrib/tree/master/docker-compose-services/RECIPE) by [@CONTRIBUTOR](https://github.com/CONTRIBUTOR)**

**Originally Contributed by [somebody](https://github.com/somebody) in https://github.com/drud/ddev-contrib/...)


33 changes: 19 additions & 14 deletions tests/test.bats
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
setup() {
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
export TESTDIR=$(mktemp -d -t testmemcached-XXXXXXXXXX)
export PROJNAME=testmemcached
export TESTDIR=~/tmp/testelasticsearch
mkdir -p $TESTDIR
export PROJNAME=test-addon-template
export DDEV_NON_INTERACTIVE=true
ddev delete -Oy ${PROJNAME} || true
cd "${TESTDIR}"
ddev config --project-name=${PROJNAME} --project-type=drupal9 --docroot=web --create-docroot
ddev config --project-name=${PROJNAME}
ddev start
}

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" {
@test "install from directory" {
cd ${TESTDIR}
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
ddev get ${DIR}
ddev restart
# v=$(ddev exec 'printf "version\nquit\nquit\n" | nc memcached 11211')
# [[ "${v}" = VERSION* ]]
# res=$(ddev exec 'printf "list-tubes\nquit\n" | nc -C beanstalkd 11300')
# [[ "${res}" = OK* ]]
# 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
# Do something here to verify functioning extra service
# For extra credit, use a real CMS with actual config.
# ddev exec "curl -s elasticsearch:9200" | grep "${PROJNAME}-elasticsearch"

}

@test "install from release" {
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 restart
# ddev exec "curl -s elasticsearch:9200" | grep "${PROJNAME}-elasticsearch"
}

0 comments on commit b071da5

Please sign in to comment.