-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Integration Test Framework #67
Comments
What I might change is that it would be really nice/useful if the integration tests can use our example applications as test fixtures. This way the application that a new user might try out is one we know we've hit with testing. I wonder if an approach that uses |
I like the idea of combining the examples and test fixtures - since it does promote DRY. Wouldn't it make creating fixtures more difficult? Especially if you wanted to make a lot of fixtures that had just one minor change. But I really do like the idea of using compose to set up an environment instead of having test.sh do it. How about the tests folder has a compose file which can reference any TravisCI has docker-compose available. |
Merged in #72 and awaiting 1.0 release. |
Released in RC: https://github.com/joyent/containerbuddy/releases/tag/0.1.1 |
My goal is to make it somewhat easy to create new integration tests by factoring
out the common logic into a simple framework.
It might be overkill though, maybe there is an easier way to do it.
Folder Structure
integration_tests/fixtures
- Contains folder for each test harnessintegration_tests/tests
- Contains folders for each integration testFixtures
integration_tests/fixtures/fixture_name
- Folder contains aDockerfile
for building a Conatainerbuddy app - resulting in an image named
fixture_name
The
Dockerfile
should specify an ENTRYPOINT/CMD and should not require any arguments.Tests
integration_tests/tests/test_name
test.sh
scriptdocker-compose.yml
for setting up the test environmentIf
test.sh
returns success:0
then the test passed, otherwise it failedThis script can make some assumptions:
containerbuddy_etcd
andcontainerbuddy_consul
are running and are fresh (no data)integration_tests/fixtures
are created and are available as images - requiring no argumentsRunning Tests
Make target
integration_test
The script in the top-level folder named
test.sh
will:Setup Test Fixtures
integration_tests/fixtures
in alpha orderbuild
intointegration_test/fixtures/fixture_name/build
so it can easily be sourced by theDockerfile
cd integration_tests/fixtures/fixture_name
docker build -t fixture_name .
build
folder to clean up (should add to .gitignore also)Note: Since fixtures are created in alpha order, they can have FROM directives for previously
created images - so as to reduce duplication.
Run tests
integration_tests/tests
in alpha ordercontainerbuddy_etcd
andcontainterbuddy_consul
docker-compose.yml
to bring up the test environmentintegration_test/tests/test_name/test.sh
The text was updated successfully, but these errors were encountered: