Skip to content

Commit

Permalink
Add wrapper for serverspec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mblaschke committed Feb 3, 2017
1 parent ea4f25f commit 05b1072
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bin/webdevops/taskloader/DockerTestServerspecTaskLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def task_run(dockerfile, configuration, task):
return True

# build rspec/serverspec command
cmd = ['bundle', 'exec', 'rspec']
cmd = ['bash', 'serverspec.sh']
cmd.extend(serverspec_opts)

# Set environment variables
Expand Down
21 changes: 21 additions & 0 deletions tests/serverspec/serverspec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Check if DOCKERFILE is set, needed for test
if [[ -z "$DOCKERFILE" ]]; then
echo "Environment variable 'DOCKERFILE' not set"
exit 1
fi

# Check if dockerfile exists
if [[ ! -f "${DOCKERFILE}" ]]; then
# Filesystem is maybe not synced?
sync

# recheck if file is now available
if [[ ! -f "${DOCKERFILE}" ]]; then
echo "Dockerfile $DOCKERFILE' not found"
exit 1
fi
fi

exec bundle exec rspec "$@"

0 comments on commit 05b1072

Please sign in to comment.