Skip to content

Commit

Permalink
Fix and enhance Jenkins test for Selenium.
Browse files Browse the repository at this point in the history
- If condition on fa3d206 was exactly wrong.
- Check for docker-compose services up before and during polling to wait for Galaxy - if Galaxy isn't going to work just die.
- Improved logging.
  • Loading branch information
jmchilton committed Dec 1, 2016
1 parent fa3d206 commit e731b6f
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions .ci/jenkins/selenium/run_tests.sh
Expand Up @@ -5,13 +5,13 @@ TEST_DIRECTORY=`dirname $0`
DEFAULT_COMPOSE_PROJECT_NAME=`basename $TEST_DIRECTORY`
COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-$DEFAULT_COMPOSE_PROJECT_NAME}
# If in Jenkins environment, append ${BUILD_NUMBER} to project so builds don't interfer.
if [ -z "$BUILD_NUMBER" ];
if [ ! -z "$BUILD_NUMBER" ];
then
COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME}-${BUILD_NUMBER}"
fi
export COMPOSE_PROJECT_NAME

echo $TEST_DIRECTORY
echo "Running Jenkins test from $TEST_DIRECTORY with compose project name $COMPOSE_PROJECT_NAME"

find lib -iname '*pyc' -exec rm -rf {} \;
find test -iname '*pyc' -exec rm -rf {} \;
Expand All @@ -31,9 +31,29 @@ export TARGET_PATH=/galaxy

cd $TEST_DIRECTORY

echo "Cleaning up previous executions if needed."
docker-compose down | true
docker-compose build galaxy
docker-compose up -d

for service_name in postgres galaxy selenium
do
echo "Waiting on service ${service_name}"
while true
do
if docker ps | grep -q "${COMPOSE_PROJECT_NAME}_${service_name}"
then
echo "Service ${service_name} ready."
break
fi
printf "."
sleep 1;
done
done

docker ps | grep -q 'prickly_x'


if [ "$1" = "--debug-running-containers" ];
then
env
Expand All @@ -45,8 +65,18 @@ export GALAXY_TEST_EXTERNAL="http://localhost:$GALAXY_PORT/"
echo "Waiting on docker-compose managed Galaxy server - $GALAXY_TEST_EXTERNAL."
while ! curl -s "$GALAXY_TEST_EXTERNAL";
do
for service_name in postgres galaxy selenium
do
if ! docker ps | grep -q "${COMPOSE_PROJECT_NAME}_${service_name}"
then
echo "Service ${service_name} stopped, exiting and halting containers."
docker-compose down | true
exit 1
fi
done

printf "."
sleep 1;
sleep 4;
done;

# Access Selenium on localhost via port $SELENIUM_PORT
Expand All @@ -66,7 +96,6 @@ exit_code=$?

cd $TEST_DIRECTORY

docker-compose stop
docker-compose rm -f
docker-compose down

exit $exit_code

0 comments on commit e731b6f

Please sign in to comment.