Commit d2bb6c5b authored by Hunter Loftis's avatar Hunter Loftis

document docker tests

parent 6a77ced9
......@@ -169,22 +169,21 @@ heroku config:set BUILDPACK_URL=<your-github-url>#your-branch
## Testing
[Anvil](https://github.com/ddollar/anvil) is a generic build server for Heroku.
The buildpack tests use [Docker](https://www.docker.com/) to simulate
Heroku's Cedar and Cedar-14 containers.
```
gem install anvil-cli
```
The [heroku-anvil CLI plugin](https://github.com/ddollar/heroku-anvil) is a wrapper for anvil.
To run the test suite:
```
heroku plugins:install https://github.com/ddollar/heroku-anvil
test/docker
```
The [ddollar/test](https://github.com/ddollar/buildpack-test) buildpack runs `bin/test` on your app/buildpack.
Or to just test in cedar or cedar-14:
```
heroku build -b ddollar/test # -b can also point to a local directory
test/docker cedar
test/docker cedar-14
```
For more info on testing, see [Best Practices for Testing Buildpacks](https://discussion.heroku.com/t/best-practices-for-testing-buildpacks/294) on the Heroku discussion forum.
The tests are run via the vendored [shunit2](http://shunit2.googlecode.com/svn/trunk/source/2.1/doc/shunit2.html)
test framework.
#!/usr/bin/env bash
echo "Running tests in docker (cedar-14)..."
docker run -v $(pwd):/buildpack:ro --rm -it heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
echo ""
echo "Running tests in docker (cedar)..."
docker run -v $(pwd):/buildpack:ro --rm -it fabiokung/cedar bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
cedar-14() {
echo "Running tests in docker (cedar-14)..."
docker run -v $(pwd):/buildpack:ro --rm -it heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
echo ""
}
cedar() {
echo "Running tests in docker (cedar)..."
docker run -v $(pwd):/buildpack:ro --rm -it fabiokung/cedar bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
}
if [ "$1" == "cedar-14" ]; then
cedar-14
elif [ "$1" == "cedar" ]; then
cedar
else
cedar-14
cedar
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment