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

Xmas 2022 updates #55

Merged
Merged
Show file tree
Hide file tree
Changes from 9 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
6 changes: 3 additions & 3 deletions .buildkite/pipeline.deploy.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
steps:
- label: ":docker: :hammer:"
plugins:
docker-compose#v4.5.0:
docker-compose#v4.9.0:
run: tests

- wait

- label: ":docker: :rocket: Latest"
plugins:
docker-login#v2.1.0: ~
docker-compose#v4.5.0:
docker-compose#v4.9.0:
push: latest
if: |
build.branch == 'main'

- label: ":docker: :rocket: Tag"
plugins:
docker-login#v2.1.0: ~
docker-compose#v4.5.0:
docker-compose#v4.9.0:
push: tag
if: |
build.tag != null
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- label: ":docker: :hammer:"
plugins:
docker-compose#v4.5.0:
docker-compose#v4.9.0:
run: tests
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM bats/bats:latest@sha256:c707c5b7f9afd49da3e8a94248b03832e8b427f1b8f1ae9ec3cfdc5596d9c9f4
FROM bats/bats:latest@sha256:c3db40540a4942497a8c7ca1ea9fbbf2faf269381f2761380c29154edf5526c4

RUN apk --no-cache add ncurses curl jq

Expand All @@ -11,7 +11,7 @@ RUN mkdir -p /usr/local/lib/bats/bats-support \

# Install bats-assert
RUN mkdir -p /usr/local/lib/bats/bats-assert \
&& curl -sSL https://github.com/bats-core/bats-assert/archive/v0.3.0.tar.gz -o /tmp/bats-assert.tgz \
&& curl -sSL https://github.com/bats-core/bats-assert/archive/v2.1.0.tar.gz -o /tmp/bats-assert.tgz \
frankpengau marked this conversation as resolved.
Show resolved Hide resolved
&& tar -zxf /tmp/bats-assert.tgz -C /usr/local/lib/bats/bats-assert --strip 1 \
&& printf 'source "%s"\n' "/usr/local/lib/bats/bats-assert/load.bash" >> /usr/local/lib/bats/load.bash \
&& rm -rf /tmp/bats-assert.tgz
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ steps:
To test this, you'd add the following `docker-compose.yml` file:

```yml
version: '3.4'
version: '3.8'
services:
tests:
image: buildkite/plugin-tester:v3.0.1
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3.8'
frankpengau marked this conversation as resolved.
Show resolved Hide resolved
services:
tests:
build: .
Expand Down
30 changes: 30 additions & 0 deletions tests/test-plugin/tests/test-failure.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bats

setup() {
load "$BATS_PLUGIN_PATH/load.bash"

# Uncomment to enable stub debugging
# export BAR_STUB_DEBUG=/dev/tty
}

@test "bats intentional failure - expects Not AOK" {
run bash -c "echo 'Not AOK!'; exit 1"
assert_failure
}

@test "bats-mock should throw error" {
stub bar "foo : exit 1"
run bar foo
assert_failure
unstub bar
}

@test "bats intentional failure - alerts error" {
run echo "error"

refute_line "success"
assert_line "error"

run exit 1
assert_failure
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ load "$BATS_PLUGIN_PATH/load.bash"
# export FOO_STUB_DEBUG=/dev/tty

@test "bats works AOK" {
echo "AOK"
run echo 'AOK'
assert_success
}

@test "bats-mock works" {
stub foo "bar : echo baz"
foo bar
run foo bar
assert_success
unstub foo
}
}