-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix parallel execution environment * Add more verbose messages for spec init/run * Reduce python cpu usage for wait loop * Set threads to auto for test target
- Loading branch information
Showing
38 changed files
with
237 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
require 'rake' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec.configure do |config| | ||
# show retry status in spec process | ||
config.verbose_retry = true | ||
# show exception that triggers a retry if verbose_retry is set to true | ||
config.display_try_failure_messages = true | ||
end | ||
begin | ||
require 'rake' | ||
require 'json' | ||
require 'base64' | ||
require 'docker' | ||
require 'rspec' | ||
require 'serverspec' | ||
require 'rspec/retry' | ||
require 'rspec/core/rake_task' | ||
|
||
RSpec::Core::RakeTask.new(:spec, :pattern, :dockerImageName, :configuration) do |t, task_args| | ||
t.pattern = task_args[:pattern] | ||
t.fail_on_error = true | ||
|
||
# hide command | ||
t.verbose = false | ||
|
||
$specConfiguration = JSON.parse(Base64.decode64(task_args[:configuration])) | ||
|
||
$dockerImage = Docker::Image.build_from_dir('.', { 'dockerfile' => $specConfiguration['DOCKERFILE'] }) | ||
$specConfiguration['DOCKERIMAGE_ID'] = $dockerImage.id | ||
|
||
print "\n" | ||
print "Environment configuration\n" | ||
print "-------------------------\n" | ||
$specConfiguration.each do |key, value| | ||
print " " + key + ':' + value + "\n" | ||
ENV[key] = value | ||
end | ||
print "\n" | ||
print "\n" | ||
end | ||
|
||
RSpec::Core::RakeTask.new(:"spec") do |t, args| | ||
#t.pattern = 'spec/base/*_spec.rb' | ||
rescue LoadError | ||
# no rspec available | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,19 @@ | ||
#!/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 | ||
set -o pipefail ## trace ERR through pipes | ||
set -o errtrace ## trace ERR through 'time command' and other functions | ||
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable | ||
set -o errexit ## set -e : exit the script if any statement returns a non-true return value | ||
|
||
# Check if dockerfile exists | ||
if [[ ! -f "${DOCKERFILE}" ]]; then | ||
# Filesystem is maybe not synced? | ||
sync | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
# recheck if file is now available | ||
if [[ ! -f "${DOCKERFILE}" ]]; then | ||
echo "Dockerfile $DOCKERFILE' not found" | ||
exit 1 | ||
fi | ||
fi | ||
PARAM_SPEC_FILE="$1" | ||
PARAM_DOCKER_IMAGE="$2" | ||
PARAM_SPEC_CONF="$3" | ||
|
||
# Check if DOCKER_IMAGE is set, needed for test | ||
if [[ -z "$DOCKER_IMAGE" ]]; then | ||
echo "Environment variable 'DOCKER_IMAGE' not set" | ||
exit 1 | ||
fi | ||
# LOGFILE="${PARAM_DOCKER_IMAGE//:/_}" | ||
# LOGFILE="${PARAM_DOCKER_IMAGE//\//_}" | ||
# LOGFILE="${SCRIPT_DIR}/logs/${LOGFILE}.log" | ||
|
||
# Check if DOCKER_TAG is set, needed for test | ||
if [[ -z "$DOCKER_TAG" ]]; then | ||
echo "Environment variable 'DOCKER_TAG' not set" | ||
exit 1 | ||
fi | ||
exec bundle exec rake spec["$PARAM_SPEC_FILE","$PARAM_DOCKER_IMAGE","$PARAM_SPEC_CONF"] | ||
|
||
# Check if OS_FAMILY is set, needed for test | ||
if [[ -z "$OS_FAMILY" ]]; then | ||
echo "Environment variable 'OS_FAMILY' not set" | ||
exit 1 | ||
fi | ||
|
||
# Check if OS_FAMILY is set, needed for test | ||
if [[ -z "$OS_VERSION" ]]; then | ||
echo "Environment variable 'OS_FAMILY' not set" | ||
exit 1 | ||
fi | ||
|
||
echo "Starting serverspec" | ||
echo " OS: ${OS_FAMILY} Version ${OS_VERSION}" | ||
echo " Docker image: ${DOCKER_IMAGE}:${DOCKER_TAG}" | ||
echo " Dockerfile: ${DOCKERFILE}" | ||
echo "" | ||
|
||
exec bundle exec rspec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.