Skip to content

Commit 00a6395

Browse files
committed
switch to bats for integration testing
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
1 parent d65f66a commit 00a6395

File tree

8 files changed

+267
-284
lines changed

8 files changed

+267
-284
lines changed

README.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,53 @@ the coverage for the VirtualBox driver's package, browse to `/drivers/virtualbox
122122
You can hit `CTRL+C` to stop the server.
123123

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

129-
By default, the suite will run tests against all drivers in master. You can
130-
override this by setting the environment variable `MACHINE_TESTS`. For example,
131-
`MACHINE_TESTS="virtualbox" ./script/run-integration-tests` will only run the
132-
virtualbox driver integration tests.
130+
```
131+
$ DRIVER=virtualbox bats test/driver.bats
132+
✓ virtualbox: machine should not exist
133+
✓ virtualbox: create
134+
✓ virtualbox: active
135+
✓ virtualbox: ls
136+
✓ virtualbox: url
137+
✓ virtualbox: ip
138+
✓ virtualbox: ssh
139+
✓ virtualbox: stop
140+
✓ virtualbox: machine should show stopped
141+
✓ virtualbox: start
142+
✓ virtualbox: machine should show running after start
143+
✓ virtualbox: restart
144+
✓ virtualbox: machine should show running after restart
145+
✓ virtualbox: remove
146+
✓ virtualbox: machine should not exist
147+
148+
15 tests, 0 failures
149+
```
133150

134-
You can set the path to the machine binary under test using the `MACHINE_BINARY`
135-
environment variable.
151+
You can also run the general `cli` tests:
136152

137-
To run, use the helper script `./script/run-integration-tests`.
153+
```
154+
$ bats test/cli.bats
155+
✓ cli: show info
156+
✓ cli: show active help
157+
✓ cli: show config help
158+
✓ cli: show inspect help
159+
✓ cli: show ip help
160+
✓ cli: show kill help
161+
✓ cli: show ls help
162+
✓ cli: show restart help
163+
✓ cli: show rm help
164+
✓ cli: show env help
165+
✓ cli: show ssh help
166+
✓ cli: show start help
167+
✓ cli: show stop help
168+
✓ cli: show upgrade help
169+
✓ cli: show url help
170+
✓ flag: show version
171+
✓ flag: show help
172+
173+
17 tests, 0 failures
174+
```

_integration-test/machine_test.go

Lines changed: 0 additions & 157 deletions
This file was deleted.

_integration-test/test_vars.go

Lines changed: 0 additions & 72 deletions
This file was deleted.

_integration-test/utils.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

test/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
env-*

0 commit comments

Comments
 (0)