From dedae648397da7f4a4b7bac96d4fa1641bf74eb4 Mon Sep 17 00:00:00 2001 From: "Cezar.Leahu" Date: Thu, 20 Aug 2020 21:58:28 +0300 Subject: [PATCH] APPS-261 Update the WORM test setup --- .travis.yml | 12 +++++------- scripts/start-compose.sh | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0fcb130bdc..5ac5631437 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,17 +66,15 @@ jobs: - name: "Enterprise WORM Tests" stage: Tests install: - - travis_retry travis_wait 90 mvn -B -U -q install $MVN_SKIP -PbuildDockerImage -pl :alfresco-governance-services-enterprise-repo,:alfresco-governance-services-enterprise-share -am - - travis_retry travis_wait 30 mvn -B -U -q install $MVN_SKIP -pl :alfresco-governance-services-automation-enterprise-rest-api -am + - travis_retry travis_wait 90 mvn -B -U -q clean install ${MVN_SKIP} -PbuildDockerImage -pl :alfresco-governance-services-enterprise-repo,:alfresco-governance-services-enterprise-share -am + - travis_retry travis_wait 30 mvn -B -U -q clean install ${MVN_SKIP} -pl :alfresco-governance-services-automation-enterprise-rest-api -am before_script: - bash scripts/create-worm-bucket.sh - - bash scripts/start-compose.sh "${PWD}/${ENTERPRISE_SHARE_PATH}/worm-support-docker-compose.yml" + - bash scripts/start-compose.sh "${ENTERPRISE_SHARE_PATH}/worm-support-docker-compose.yml" - bash scripts/waitForAlfrescoToStart.sh - script: - - cd $AUTOMATION_ENTERPRISE_PATH - - mvn -B -U test -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false + script: mvn -B -U clean test -pl :alfresco-governance-services-automation-enterprise-rest-api -DsuiteXmlFile=wormTestSuite.xml -Dskip.automationtests=false after_script: bash scripts/cleanup.sh - after_failure: docker ps -a | grep '_alfresco_1_' | awk '{print $1}' | xargs docker logs | tail -5000 + after_failure: docker ps -a | grep '_alfresco_1' | awk '{print $1}' | xargs docker logs | tail -5000 # - name: "Community Integrations Tests on MySQL" # stage: Tests diff --git a/scripts/start-compose.sh b/scripts/start-compose.sh index af3b2272b8..9cc5bc5f78 100644 --- a/scripts/start-compose.sh +++ b/scripts/start-compose.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export DOCKER_COMPOSE_PATH=$1 +export DOCKER_COMPOSE_PATH="${1}" if [ -z "$DOCKER_COMPOSE_PATH" ] ; then echo "Please provide path to docker-compose.yml: \"${0##*/} /path/to/docker-compose.yml\"" @@ -23,3 +23,25 @@ else echo "Docker Compose failed to start" >&2 exit 1 fi + +WAIT_INTERVAL=1 +COUNTER=0 +TIMEOUT=300 +t0=$(date +%s) + +echo "Waiting for alfresco to start" +until $(curl --output /dev/null --silent --head --fail http://localhost:8080/alfresco) || [ "$COUNTER" -eq "$TIMEOUT" ]; do + printf '.' + sleep ${WAIT_INTERVAL} + COUNTER=$(($COUNTER+$WAIT_INTERVAL)) +done + +if (("$COUNTER" < "$TIMEOUT")) ; then + t1=$(date +%s) + delta=$(( ($t1 - $t0)/60 )) + echo "Alfresco Started in $delta minutes" +else + echo "Waited ${COUNTER} seconds" + echo "Alfresco Could not start in time." + exit 1 +fi