Public | Automated Build

Last pushed: 2 days ago
Short Description
Docker image designed to run serverspec tests against other images.
Full Description

Dockerspec

This repo contains a docker image used to run serverspec tests against other docker images. The image is designed to start another
image and run tests against it. By default, image is automatically built from ./Dockerfile - this behavior can be overriden
by --image and --container options. Default test location is ./spec.

Usage

$ docker run -t --rm -w /work -v "$(pwd):/work" -v '/var/run/docker.sock:/var/run/docker.sock' samepagelabs/dockerspec [options]

Options:

  • -d, --init-delay=<delay> Wait number of seconds before running tests (default: 0)
  • -r, --force-run Override entrypoint for command only images that exit immediately
  • -i, --image=<id> Start already built image
  • -c, --container=<id> Connect to running container
  • -u, --docker-url=<url> Override default docker api endpoint
  • -o, --rspec-opts=<opts> Override default rspec opts (default: --format=doc --color)
  • -s, --spec-path=<path> Path to spec files (default: ./spec)
  • -h, --help Show this message

Writing tests

See spec directory for example implementation. See serverspec homepage for detailed explanation of serverspec capabilities.

Following example checks nginx process status:

require 'dockerspec'

describe process('nginx') do
    it {should be_running}
end

You are limited a bit by the content of the container being tested. For example, following test causes false positive without netstat tool being present
in the container:

describe port(80) do
    it {should be_listening}
end
Docker Pull Command
Owner
samepagelabs
Source Repository

Comments (0)