Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

switch to bats for integration testing #615

Merged
merged 8 commits into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 50 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,56 @@ the coverage for the VirtualBox driver's package, browse to `/drivers/virtualbox
You can hit `CTRL+C` to stop the server.

## Integration Tests
There is a suite of integration tests that will run for the drivers. In order
to use these you must export the corresponding environment variables for each
driver as these perform the actual actions (start, stop, restart, kill, etc).
We utilize [BATS](https://github.com/sstephenson/bats) for integration testing.
This runs tests against the generated binary. To use, make sure to install
BATS (use that link). Then run `./script/build` to generate the binary. Once
you have the binary, you can run test against a specified driver:

By default, the suite will run tests against all drivers in master. You can
override this by setting the environment variable `MACHINE_TESTS`. For example,
`MACHINE_TESTS="virtualbox" ./script/run-integration-tests` will only run the
virtualbox driver integration tests.
```
$ bats integration-tests/driver-virtualbox.bats
✓ virtualbox: machine should not exist
✓ virtualbox: VM should not exist
✓ virtualbox: create
✓ virtualbox: active
✓ virtualbox: ls
✓ virtualbox: run busybox container
✓ virtualbox: url
✓ virtualbox: ip
✓ virtualbox: ssh
✓ virtualbox: stop
✓ virtualbox: machine should show stopped
✓ virtualbox: start
✓ virtualbox: machine should show running after start
✓ virtualbox: restart
✓ virtualbox: machine should show running after restart
✓ virtualbox: remove
✓ virtualbox: machine should not exist
✓ virtualbox: VM should not exist

15 tests, 0 failures
```

You can set the path to the machine binary under test using the `MACHINE_BINARY`
environment variable.
You can also run the general `cli` tests:

To run, use the helper script `./script/run-integration-tests`.
```
$ bats integration-tests/cli.bats
✓ cli: show info
✓ cli: show active help
✓ cli: show config help
✓ cli: show inspect help
✓ cli: show ip help
✓ cli: show kill help
✓ cli: show ls help
✓ cli: show restart help
✓ cli: show rm help
✓ cli: show env help
✓ cli: show ssh help
✓ cli: show start help
✓ cli: show stop help
✓ cli: show upgrade help
✓ cli: show url help
✓ flag: show version
✓ flag: show help

17 tests, 0 failures
```
157 changes: 0 additions & 157 deletions _integration-test/machine_test.go

This file was deleted.

72 changes: 0 additions & 72 deletions _integration-test/test_vars.go

This file was deleted.

45 changes: 0 additions & 45 deletions _integration-test/utils.go

This file was deleted.

Loading