-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from buildkite-plugins/toote_fix_tests
Plugin tester update
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
version: '2' | ||
services: | ||
tests: | ||
image: buildkite/plugin-tester:v3.0.1 | ||
image: buildkite/plugin-tester:v4.0.0 | ||
volumes: | ||
- ".:/plugin:ro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bats | ||
|
||
load '/usr/local/lib/bats/load.bash' | ||
|
||
setup() { | ||
export BUILDKITE_PLUGIN_DOCKER_IMAGE=image:tag | ||
export BUILDKITE_JOB_ID="1-2-3-4" | ||
export BUILDKITE_PLUGIN_DOCKER_CLEANUP=false | ||
export BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT=false | ||
export BUILDKITE_COMMAND="pwd" | ||
export OSTYPE="win" # important to define these test as windows | ||
} | ||
|
||
@test "Run with BUILDKITE_COMMAND" { | ||
export BUILDKITE_COMMAND='command1 "a string"' | ||
export BUILDKITE_AGENT_BINARY_PATH="/buildkite-agent" | ||
unset BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT | ||
|
||
stub cmd.exe \ | ||
"//C $'echo %CD%' : echo WIN_PATH" | ||
|
||
stub docker \ | ||
"run -i --rm --volume \* --workdir \* --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume \* --label com.buildkite.job-id=1-2-3-4 image:tag CMD.EXE /c 'command1 \"a string\"' : echo ran command in docker" | ||
|
||
run "$PWD"/hooks/command | ||
|
||
assert_success | ||
assert_output --partial "ran command in docker" | ||
|
||
unstub docker | ||
unstub cmd.exe | ||
} |