Skip to content

Commit 104e193

Browse files
committed
Added tests for workdir interpolation
1 parent 7decade commit 104e193

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/command.bats

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,25 @@ setup() {
214214
unstub docker
215215
}
216216

217+
@test "Runs BUILDKITE_COMMAND with workdir with variables and option turned on" {
218+
# shellcheck disable=2016 # we want the variable not interpreted now
219+
export BUILDKITE_PLUGIN_DOCKER_WORKDIR='$ONE_VAR'
220+
export BUILDKITE_PLUGIN_DOCKER_EXPAND_VOLUME_VARS=true
221+
export BUILDKITE_COMMAND="pwd"
222+
223+
export ONE_VAR=/my/path
224+
225+
stub docker \
226+
"run -t -i --rm --init --volume $PWD:/my/path --workdir /my/path --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker"
227+
228+
run "$PWD"/hooks/command
229+
230+
assert_success
231+
assert_output --partial "ran command in docker"
232+
233+
unstub docker
234+
}
235+
217236
@test "Runs BUILDKITE_COMMAND with devices" {
218237
export BUILDKITE_PLUGIN_DOCKER_WORKDIR=/app
219238
export BUILDKITE_PLUGIN_DOCKER_DEVICES_0=/dev/bus/usb/001/001

0 commit comments

Comments
 (0)