Skip to content

Commit

Permalink
document docker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterloftis committed Feb 16, 2015
1 parent 6a77ced commit d2bb6c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
19 changes: 9 additions & 10 deletions README.md
Expand Up @@ -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.
24 changes: 19 additions & 5 deletions test/docker
@@ -1,7 +1,21 @@
#!/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

0 comments on commit d2bb6c5

Please sign in to comment.