Skip to content

Commit

Permalink
[OPENENGSB-3738] Use a custom script to execute itests on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed May 23, 2014
1 parent b7f78c8 commit 2849ab1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ before_install:

install: mvn validate

script: mvn install -Pitests,checkstyle,licenseCheck
script:
- mvn install -Pcheckstyle,licenseCheck
- ./etc/scripts/run-itests.sh

notifications:
email:
Expand Down
52 changes: 52 additions & 0 deletions etc/scripts/run-itests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
#
# Licensed to the Austrian Association for Software Tool Integration (AASTI)
# under one or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information regarding copyright
# ownership. The AASTI licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This script is used in the Travis-CI build environment to execute the
# integration test, and works around the issues of the integration test
# environment where tests would sporadically fail due to race conditions.
# The script finds all Java files Named *IT.java and executes them individually
# in a maven command. A failing test (possibly due to a race condition), will
# be retried a specified amount of times.

ITEST_DIR=./itests/
DEFAULT_RETRY=3;

run-test-retry() {
for i in `seq 1 $2`; do
echo "[INFO] Running test $1 - Run # $i"

if mvn test -Dtest=$1; then
return 0
fi

# TODO: filter out assertion errors (which shouldn't trigger a retry)
done

return 1
}

cd $ITEST_DIR

for test in `find -name "*IT.java" -exec sh -c 'basename {} | cut -d'.' --complement -f2-' \;`; do
if ! run-test-retry $test $DEFAULT_RETRY; then
echo "[ERROR] Test $test FAILED after $DEFAULT_RETRY retries"
exit 1
fi
done

exit 0

0 comments on commit 2849ab1

Please sign in to comment.