dockertest-server
A test framework built around dockertest for testing against server containers.
This crate provides a small abstraction layer around the dockertest crate for easily running a test against multiple servers running in containers. It provides traits for defining a server and it's associated configuration and then registering a variable number of servers to bring up for a test.
The primary use-case of this crate is to provide an easy-to-use testing framework for crates that wish to build integration tests against services which are able to run in a container.
Installation
Add dockertest-server as a depdendency to your cargo.toml:
[dev-dependencies]
dockertest-server = "0.1.0"
Usage
The below example brings up a mock OAuth server and then tests it's responding to HTTP requests:
// Note: This requires the `web` feature
use ;
use Test;
let config = builder.port.build.unwrap;
let mut test = new;
test.register;
test.run;
This crate ships with support for various servers already included. See the
servers module for the ones included. Note that most require a feature flag to
be enabled to avoid bundling unecessary implementations.
Please feel free to submit a PR with your own implementations to be added to the main crate.
Testing
Run tests with cargo test.
Contributing
Check out the issues for items neeeding attention or submit your own and then:
- Fork the repo (https://github.com/jmgilman/dockertest-server/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request