Skip to content

Commit 1252307

Browse files
committed
Add v2 test and property validation
1 parent 6c58916 commit 1252307

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

plugin.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ configuration:
7676
type: integer
7777
rm:
7878
type: boolean
79+
service-ports:
80+
type: boolean
7981
skip-checkout:
8082
type: boolean
8183
skip-pull:

tests/v2/run.bats

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,33 @@ export BUILDKITE_JOB_ID=1111
12571257
assert_output --partial "built myservice"
12581258
assert_output --partial "ran myservice"
12591259

1260+
unstub docker
1261+
unstub buildkite-agent
1262+
}
1263+
1264+
@test "Run with --service-ports" {
1265+
export BUILDKITE_JOB_ID=1111
1266+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
1267+
export BUILDKITE_PIPELINE_SLUG=test
1268+
export BUILDKITE_BUILD_NUMBER=1
1269+
export BUILDKITE_COMMAND=pwd
1270+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CHECK_LINKED_CONTAINERS=false
1271+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLEANUP=false
1272+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_SERVICE_PORTS=true
1273+
1274+
stub docker \
1275+
"compose -f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml pull myservice : echo pulled myservice" \
1276+
"compose -f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml up -d --scale myservice=0 myservice : echo started dependencies for myservice" \
1277+
"compose -f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml run --name buildkite1111_myservice_build_1 --rm --service-ports myservice /bin/sh -e -c $'pwd' : echo ran myservice without tty"
1278+
1279+
stub buildkite-agent \
1280+
"meta-data exists docker-compose-plugin-built-image-tag-myservice : echo myimage" \
1281+
"meta-data get docker-compose-plugin-built-image-tag-myservice : echo myimage"
1282+
1283+
run "$PWD"/hooks/command
1284+
1285+
assert_success
1286+
assert_output --partial "ran myservice without tty"
12601287
unstub docker
12611288
unstub buildkite-agent
12621289
}

0 commit comments

Comments
 (0)