Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin tester update #231

Merged
merged 3 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
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"
4 changes: 2 additions & 2 deletions tests/pre-checkout.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load '/usr/local/lib/bats/load.bash'
run "$PWD"/hooks/pre-checkout

assert_success
refute_line --partial 'Skipping' # generate no output
refute_output # generate no output
}


Expand All @@ -17,7 +17,7 @@ load '/usr/local/lib/bats/load.bash'
run "$PWD"/hooks/pre-checkout

assert_success
refute_line --partial 'Skipping' # generate no output
refute_output # generate no output
}


Expand Down
32 changes: 32 additions & 0 deletions tests/windows.bats
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
}