Skip to content

Commit

Permalink
Added tests for the option
Browse files Browse the repository at this point in the history
  • Loading branch information
toote committed Nov 24, 2022
1 parent 1ead3e1 commit 049ae3c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,32 @@ export BUILDKITE_JOB_ID=1111
unstub buildkite-agent
}

@test "Run with dependencies but in a single step" {
export BUILDKITE_BUILD_NUMBER=1
export BUILDKITE_COMMAND=pwd
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PIPELINE_SLUG=test

export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLEANUP=false
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PRE_RUN_DEPENDENCIES=false

stub docker-compose \
"-f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml pull myservice : echo pulled myservice" \
"-f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml run --name buildkite1111_myservice_build_1 --rm myservice /bin/sh -e -c 'pwd' : echo ran myservice with dependencies"

stub buildkite-agent \
"meta-data exists docker-compose-plugin-built-image-tag-myservice : exit 0" \
"meta-data get docker-compose-plugin-built-image-tag-myservice : echo myimage"

run "$PWD"/hooks/command

assert_success
assert_output --partial "ran myservice with dependencies"
unstub docker-compose
unstub buildkite-agent
}

@test "Run without ansi output" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
Expand Down
27 changes: 27 additions & 0 deletions tests/v2/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,33 @@ export BUILDKITE_JOB_ID=1111
unstub buildkite-agent
}

@test "Run with dependencies but in a single step" {
export BUILDKITE_BUILD_NUMBER=1
export BUILDKITE_COMMAND=pwd
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PIPELINE_SLUG=test

export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLEANUP=false
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PRE_RUN_DEPENDENCIES=false

stub docker \
"compose -f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml pull myservice : echo pulled myservice" \
"compose -f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml run --name buildkite1111_myservice_build_1 --rm myservice /bin/sh -e -c 'pwd' : echo ran myservice with dependencies"

stub buildkite-agent \
"meta-data exists docker-compose-plugin-built-image-tag-myservice : exit 0" \
"meta-data get docker-compose-plugin-built-image-tag-myservice : echo myimage"

run "$PWD"/hooks/command

assert_success
assert_output --partial "ran myservice with dependencies"

unstub docker
unstub buildkite-agent
}

@test "Run without ansi output" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
Expand Down

0 comments on commit 049ae3c

Please sign in to comment.