1#!/bin/bash 2 3# stop on first error 4set -e 5set -u 6 7echo "start testing ... " 8echo "TRAVIS_BRANCH: $TRAVIS_BRANCH" 9echo "USER: $USER" 10echo "DB: $DB" 11 12echo "--------- starting services ----------- " 13service bareos-dir start 14service bareos-sd start 15service bareos-fd start 16sleep 10 17 18echo "--------- checking services ----------- " 19service bareos-dir status 20service bareos-sd status 21service bareos-fd status 22 23 24# enable bash debug 25set -v 26 27BACKUP_TEST_FILE=/usr/sbin/bareos.test 28 29echo "----- create some file to test backup / restore ----" 30echo "bareos restore test" > ${BACKUP_TEST_FILE} 31echo 32echo -e "status dir" | bconsole 33echo 34#echo "---- label a volume ----" 35#echo -e "label volume=testvol pool=Full" | bconsole 36#echo 37echo "------ trigger backup job -----" 38echo -e "run job=backup-bareos-fd yes\rwait" | bconsole | grep "Job queued. JobId=" 39echo "status dir" | bconsole 40echo 41echo "------ trigger restore job -----" 42echo -e "restore select current\r2\rls\rmark usr\rdone\ryes\rwait" | bconsole 43echo "status dir" | bconsole 44grep "bareos restore test" /tmp/bareos-restores/${BACKUP_TEST_FILE} 45 46if [ "${BUILD_WEBUI:-}" ]; then 47 # show environment 48 export | grep " TRAVIS" 49 50 service apache2 restart 51 #service apache2 status 52 export BAREOS_BROWSER="none" 53 export BAREOS_USERNAME="citest" 54 export BAREOS_PASSWORD="citestpass" 55 export BAREOS_CLIENT_NAME="$HOSTNAME-fd" 56 echo "--------- testing webui over selenium -----------" 57 echo "configure add console name=citest password=citestpass profile=webui-admin" | bconsole 58 python ${TRAVIS_BUILD_DIR}/webui/tests/selenium/webui-selenium-test.py -v 59fi 60