Skip to content

Commit

Permalink
Merge pull request #55 from frankpengau/xmas-2022-updates
Browse files Browse the repository at this point in the history
Dependencies updates
  • Loading branch information
pzeballos authored Jan 5, 2023
2 parents 081ee10 + e125feb commit 5cb9be4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 12 deletions.
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
6 changes: 3 additions & 3 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:1.8.2-no-faccessat2@sha256:ab8b147d6fd604a25872580db473a61d446370af00addfe0a0d8b4394eae0f6b

RUN apk --no-cache add ncurses curl jq

Expand All @@ -11,14 +11,14 @@ 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 \
&& 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

# Install lox's fork of bats-mock
RUN mkdir -p /usr/local/lib/bats/bats-mock \
&& curl -sSL https://github.com/buildkite-plugins/bats-mock/archive/v2.0.1.tar.gz -o /tmp/bats-mock.tgz \
&& curl -sSL https://github.com/buildkite-plugins/bats-mock/archive/v2.1.0.tar.gz -o /tmp/bats-mock.tgz \
&& tar -zxf /tmp/bats-mock.tgz -C /usr/local/lib/bats/bats-mock --strip 1 \
&& printf 'source "%s"\n' "/usr/local/lib/bats/bats-mock/stub.bash" >> /usr/local/lib/bats/load.bash \
&& rm -rf /tmp/bats-mock.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.7'
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.7'
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
}
}

0 comments on commit 5cb9be4

Please sign in to comment.