X Tutup
Skip to content

Commit dd20827

Browse files
committed
check for VM in virtualbox; add stub for coverage
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
1 parent 26d09cf commit dd20827

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ BATS (use that link). Then run `./script/build` to generate the binary. Once
128128
you have the binary, you can run test against a specified driver:
129129

130130
```
131-
$ DRIVER=virtualbox bats test/driver.bats
131+
$ bats test/driver-virtualbox.bats
132132
✓ virtualbox: machine should not exist
133+
✓ virtualbox: VM should not exist
133134
✓ virtualbox: create
134135
✓ virtualbox: active
135136
✓ virtualbox: ls
137+
✓ virtualbox: run busybox container
136138
✓ virtualbox: url
137139
✓ virtualbox: ip
138140
✓ virtualbox: ssh
@@ -144,6 +146,7 @@ $ DRIVER=virtualbox bats test/driver.bats
144146
✓ virtualbox: machine should show running after restart
145147
✓ virtualbox: remove
146148
✓ virtualbox: machine should not exist
149+
✓ virtualbox: VM should not exist
147150
148151
15 tests, 0 failures
149152
```

test/driver-virtualbox.bats

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ function setup() {
1616
[ "$status" -eq 1 ]
1717
}
1818

19+
@test "$DRIVER: VM should not exist" {
20+
run VBoxManage showvminfo $NAME
21+
[ "$status" -eq 1 ]
22+
}
23+
1924
@test "$DRIVER: create" {
2025
run machine create -d $DRIVER $NAME
2126
[ "$status" -eq 0 ]
@@ -109,6 +114,11 @@ function setup() {
109114
[ "$status" -eq 1 ]
110115
}
111116

117+
@test "$DRIVER: VM should not exist" {
118+
run VBoxManage showvminfo $NAME
119+
[ "$status" -eq 1 ]
120+
}
121+
112122
@test "$DRIVER: cleanup" {
113123
run rm -rf $MACHINE_STORAGE_PATH
114124
[ "$status" -eq 0 ]

test/test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// stub for coverage
2+
package test

0 commit comments

Comments
 (0)
X Tutup