Reputation: 109
I have a tests wrintten on java (which passes on local machine, test runs about 30 min) and I need to increase timeout in travis-ci, can I change timeout by changing .tavis.yml? This is my .tavis.yml file:
language: java
cache: apt
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq default-jdk maven
env:
- JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
script:
- travis_wait mvn package -Dtestng=test.xml
I'm asking because I have an error on travis:
Timeout (20 minutes) reached. Terminating "mvn package -Dtestng=test.xml"
So, do I have any option to change time out? May be I need to write down something to .tavis.yml? Thank you.
Upvotes: 10
Views: 5289
Reputation: 13247
You can increase the timeout by modifying your script command. For instance, to increase the timeout to half an hour:
- travis_wait 30 mvn package -Dtestng=test.xml
See Mor's answer for a great alternative that doesn't "hang" the build output for 30 minutes.
Upvotes: 8
Reputation: 2889
I've found the following solution taken from a GitHub Issue that works for me:
script:
- .travis/test.sh
Where test.sh
looks like this:
# send the long living command to background
./long-running-operation.sh &
# Constants
RED='\033[0;31m'
minutes=0
limit=3
while kill -0 $! >/dev/null 2>&1; do
echo -n -e " \b" # never leave evidences!
if [ $minutes == $limit ]; then
echo -e "\n"
echo -e "${RED}Test has reached a ${minutes} minutes timeout limit"
exit 1
fi
minutes=$((minutes+1))
sleep 60
done
exit 0
Upvotes: 3
Reputation: 4053
It seems your tests are not producing any output, which usually results in a timeout in 10 minutes.
However since you're prefixing the build command with travis_wait
, that timeout is increased to 20 minutes.
The shell environment in our build system provides a function that helps to work around that, at least for longer than 10 minutes.
travis_wait writes a short line to the build log every minutes for 20 minutes, extending the amount of time your command has to finish.
Double check to see if you tests are hanging.
Upvotes: 2