Skip to content

Commit 4d0c062

Browse files
committed
tests: remove teardown and add explicity unstubs for clarity on where being used
Signed-off-by: Tom Watt <tom@buildkite.com>
1 parent d488209 commit 4d0c062

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

tests/builder-instances.bats

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ load '../lib/shared'
55

66
# export DOCKER_STUB_DEBUG=/dev/tty
77

8-
teardown() {
9-
if [[ -f "${BATS_MOCK_BINDIR}/docker" ]]; then
10-
unstub docker
11-
fi
12-
}
13-
148
@test "No Builder Instance Parameters" {
159

1610
stub docker \
@@ -21,6 +15,8 @@ teardown() {
2115

2216
assert_success
2317
assert_output "~~~ :docker: Using Default Builder 'test' with Driver 'driver'"
18+
19+
unstub docker
2420
}
2521

2622
@test "Create Builder Instance with invalid Name" {
@@ -99,6 +95,8 @@ teardown() {
9995

10096
assert_failure
10197
assert_output "+++ 🚨 Builder Instance 'builder-name' does not exist"
98+
99+
unstub docker
102100
}
103101

104102
@test "Use Builder Instance that Exists" {
@@ -113,6 +111,8 @@ teardown() {
113111

114112
assert_success
115113
assert_output "~~~ :docker: Using Builder Instance '$BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILDER_NAME'"
114+
115+
unstub docker
116116
}
117117

118118
@test "Remove Builder Instance that Exists" {
@@ -130,6 +130,8 @@ teardown() {
130130

131131
assert_success
132132
assert_output "~~~ :docker: Cleaning up Builder Instance 'builder-name'"
133+
134+
unstub docker
133135
}
134136

135137
@test "Remove Builder Instance that Exists with keep-daemon" {
@@ -148,6 +150,8 @@ teardown() {
148150

149151
assert_success
150152
assert_output "~~~ :docker: Cleaning up Builder Instance 'builder-name'"
153+
154+
unstub docker
151155
}
152156

153157
@test "Remove Builder Instance that Exists with keep-daemon and keep-state" {
@@ -167,6 +171,8 @@ teardown() {
167171

168172
assert_success
169173
assert_output "~~~ :docker: Cleaning up Builder Instance 'builder-name'"
174+
175+
unstub docker
170176
}
171177

172178
@test "Remove Builder Instance that does not Exists" {
@@ -182,4 +188,6 @@ teardown() {
182188

183189
assert_success
184190
assert_output "~~~ :warning: Cannot remove Builder Instance 'builder-name' as does not exist"
191+
192+
unstub docker
185193
}

0 commit comments

Comments
 (0)