Skip to content

Commit

Permalink
Replace bats tests with goss entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
lox committed Oct 23, 2018
1 parent 17d7dca commit 42caca3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
9 changes: 1 addition & 8 deletions .buildkite/pipeline.yml
Expand Up @@ -30,15 +30,8 @@ steps:
artifact_paths: "build/aws-stack.yml"

- wait
- name: ":buildkite: Bats Tests"
command: "/usr/local/bin/bats tests/"
timeout_in_minutes: 5
agents:
stack: "buildkite-aws-stack-test-${BUILDKITE_BUILD_NUMBER}"
queue: "testqueue-${BUILDKITE_BUILD_NUMBER}"

- name: ":buildkite: Server Specs"
command: "goss validate < /home/ec2-user/goss.yaml"
command: "goss validate --format documentation"
timeout_in_minutes: 5
agents:
stack: "buildkite-aws-stack-test-${BUILDKITE_BUILD_NUMBER}"
Expand Down
48 changes: 48 additions & 0 deletions packer/conf/goss.yaml → goss.yaml
@@ -1,28 +1,57 @@
file:
/etc/buildkite-agent/buildkite-agent.cfg:
exists: true

/etc/buildkite-agent/builds:
filetype: directory
exists: true
owner: buildkite-agent
group: buildkite-agent

/etc/buildkite-agent/hooks:
filetype: directory
exists: true
owner: buildkite-agent
group: buildkite-agent

/etc/buildkite-agent/plugins:
filetype: directory
exists: true
owner: buildkite-agent
group: buildkite-agent

port:
tcp:22:
listening: true
ip:
- 0.0.0.0

tcp6:22:
listening: true
ip:
- '::'

service:
awslogsd:
enabled: true
running: true

docker:
enabled: true
running: true

journald-cloudwatch-logs:
enabled: true
running: true

lifecycled:
enabled: true
running: true

sshd:
enabled: true
running: true

user:
buildkite-agent:
exists: true
Expand All @@ -33,6 +62,7 @@ user:
- docker
home: /var/lib/buildkite-agent
shell: /bin/bash

sshd:
exists: true
uid: 74
Expand All @@ -41,29 +71,47 @@ user:
- sshd
home: /var/empty/sshd
shell: /sbin/nologin

group:
buildkite-agent:
exists: true
gid: 2000

docker:
exists: true
gid: 1001

sshd:
exists: true
gid: 74

process:
buildkite-agent:
running: true

lifecycled:
running: true

sshd:
running: true

command:
"/etc/cron.hourly/docker-low-disk-gc":
exit-status: 0

"/etc/cron.hourly/docker-gc":
exit-status: 0

# Checks that docker is running
"docker info":
exit-status: 0

# Checks that docker containers can run
"docker run --rm -v /var/run/docker.sock:/var/run/docker.sock docker:latest version":
exit-status: 0

# Checks that permissions
'sh -c "docker run --rm -v \"$PWD:/pwd\" alpine:latest touch /pwd/test && stat -c %U:%G test"':
exit-status: 0
stdout:
- buildkite-agent:docker
1 change: 0 additions & 1 deletion packer/scripts/install-utils.sh
Expand Up @@ -26,4 +26,3 @@ sudo aws configure set s3.signature_version s3v4

echo "Installing goss for system validation..."
curl -fsSL https://goss.rocks/install | GOSS_VER=v0.3.6 sudo sh
sudo cp /tmp/conf/goss.yaml /home/ec2-user/goss.yaml
9 changes: 0 additions & 9 deletions tests/docker.bats

This file was deleted.

0 comments on commit 42caca3

Please sign in to comment.