Skip to content

Commit a5c0f0b

Browse files
committed
Add new test for the scenario
1 parent 93e2ee5 commit a5c0f0b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/run.bats

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,27 @@ teardown() {
5959
unstub buildkite-agent
6060
}
6161

62+
@test "Fail running without a prebuilt image for pull service and require-prebuild" {
63+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
64+
export BUILDKITE_COMMAND="echo hello world"
65+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_REQUIRE_PREBUILD=true
66+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_PULL=other-service
67+
68+
stub buildkite-agent \
69+
"meta-data exists docker-compose-plugin-built-image-tag-myservice : exit 0" \
70+
"meta-data get docker-compose-plugin-built-image-tag-myservice : echo myservice-image" \
71+
"meta-data exists docker-compose-plugin-built-image-tag-other-service : exit 1"
72+
73+
run "$PWD"/hooks/command
74+
75+
assert_failure
76+
77+
assert_output --partial "Found a pre-built image for myservice"
78+
assert_output --partial "No pre-built image found"
79+
80+
unstub buildkite-agent
81+
}
82+
6283
@test "Run without a prebuilt image and an empty command" {
6384
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
6485
export BUILDKITE_COMMAND=""

0 commit comments

Comments
 (0)