Skip to content

Commit b071da5

Browse files
committed
Improve base tests and readme
1 parent c3cc384 commit b071da5

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ A repository like this one is the way to get started. You can create a new repo
3333
9. Test manually with `ddev get <owner/repo>`.
3434
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).
3535
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`.
36-
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.
36+
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.
3737

3838
**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)**
3939

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

tests/test.bats

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
setup() {
22
export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.."
3-
export TESTDIR=$(mktemp -d -t testmemcached-XXXXXXXXXX)
4-
export PROJNAME=testmemcached
3+
export TESTDIR=~/tmp/testelasticsearch
4+
mkdir -p $TESTDIR
5+
export PROJNAME=test-addon-template
56
export DDEV_NON_INTERACTIVE=true
67
ddev delete -Oy ${PROJNAME} || true
78
cd "${TESTDIR}"
8-
ddev config --project-name=${PROJNAME} --project-type=drupal9 --docroot=web --create-docroot
9+
ddev config --project-name=${PROJNAME}
910
ddev start
1011
}
1112

1213
teardown() {
13-
cd ${TESTDIR}
14+
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 )
1415
ddev delete -Oy ${DDEV_SITENAME}
15-
rm -rf ${TESTDIR}
16+
[ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR}
1617
}
1718

18-
@test "basic installation" {
19+
@test "install from directory" {
1920
cd ${TESTDIR}
21+
echo "# ddev get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
2022
ddev get ${DIR}
2123
ddev restart
22-
# v=$(ddev exec 'printf "version\nquit\nquit\n" | nc memcached 11211')
23-
# [[ "${v}" = VERSION* ]]
24-
# res=$(ddev exec 'printf "list-tubes\nquit\n" | nc -C beanstalkd 11300')
25-
# [[ "${res}" = OK* ]]
26-
# status=$(ddev exec 'drush sapi-sl --format=json | jq -r .default_solr_server.status')
27-
# [ "${status}" = "enabled" ]
28-
# sleep 10 # After a restart, the solr server may not be ready yet.
29-
# ddev drush search-api-solr:reload default_solr_server
24+
# Do something here to verify functioning extra service
25+
# For extra credit, use a real CMS with actual config.
26+
# ddev exec "curl -s elasticsearch:9200" | grep "${PROJNAME}-elasticsearch"
27+
28+
}
3029

30+
@test "install from release" {
31+
cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 )
32+
echo "# ddev get drud/ddev-addon-template with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3
33+
ddev get drud/ddev-addon-template
34+
ddev restart
35+
# ddev exec "curl -s elasticsearch:9200" | grep "${PROJNAME}-elasticsearch"
3136
}

0 commit comments

Comments
 (0)