Sign inSign up

cloudhotspot/bats

By cloudhotspot

•Updated almost 10 years ago

Minimal Docker Image for running Bash Automated Testing System (BATS)

Image
0

358

cloudhotspot/bats repository overview

⁠Alpine Docker Image for BATS

This image provides a minimal image for running the Bash Automated Testing System (BATS)⁠.

The default entrypoint for this image runs bats and the default command argument specifies the folder /tests. This will run any Bats tests located in this folder.

⁠Writing Tests

See the BATS Github README for details on writing tests.

A sample test script⁠ is included in this repository and the cloudhotspot/bats image:

#!/usr/bin/env bats

@test "addition using bc" {
  result="$(echo 2+2 | bc)"
  [ "$result" -eq 4 ]
}

@test "addition using dc" {
  result="$(echo 2 2+p | dc)"
  [ "$result" -eq 4 ]
}

⁠Running Tests

To run the sample tests:

$ docker run -it --rm cloudhotspot/bats
1..2
ok 1 addition using bc
ok 2 addition using dc

To run your own tests it is recommended to create a new child image based from this image and copy your tests to the /tests folder:

# Example child image
FROM cloudhotspot/bats
COPY my-tests /tests

Tag summary

Content type

Image

Digest

Size

3.3 MB

Last updated

almost 10 years ago

docker pull cloudhotspot/bats