Skip to content

Commit

Permalink
Added tests for invalid push tags
Browse files Browse the repository at this point in the history
  • Loading branch information
toote committed Oct 11, 2022
1 parent 4069dd4 commit 63c26c1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/push.bats
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ load '../lib/shared'
unstub buildkite-agent
}

@test "Push a prebuilt image with an invalid tag" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PUSH=myservice:my.repository/myservice:-llamas
export BUILDKITE_PIPELINE_SLUG=test
export BUILDKITE_BUILD_NUMBER=1

stub docker-compose \
"-f docker-compose.yml -p buildkite1111 config : echo blah"

run $PWD/hooks/command

assert_success
refute_output --partial "pulled prebuilt image"
refute_output --partial "tagged image"
assert_output --partial "invalid tag"
unstub docker-compose
}

@test "Push a prebuilt image to multiple tags" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PUSH_0=myservice:my.repository/myservice:llamas
Expand Down
18 changes: 18 additions & 0 deletions tests/v2/push.bats
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ setup_file() {
unstub buildkite-agent
}

@test "Push a prebuilt image with an invalid tag" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PUSH=myservice:my.repository/myservice:-llamas
export BUILDKITE_PIPELINE_SLUG=test
export BUILDKITE_BUILD_NUMBER=1

stub docker \
"compose -f docker-compose.yml -p buildkite1111 config : echo blah"

run $PWD/hooks/command

assert_success
refute_output --partial "pulled prebuilt image"
refute_output --partial "tagged image"
assert_output --partial "invalid tag"
unstub docker
}

@test "Push a prebuilt image to multiple tags" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PUSH_0=myservice:my.repository/myservice:llamas
Expand Down

0 comments on commit 63c26c1

Please sign in to comment.