Skip to content

Commit

Permalink
travis: integrate Selenium checks using of https://saucelabs.com.
Browse files Browse the repository at this point in the history
Also fixes the selenium test script
and source Coverity secret in https://travis-ci.org settings.
  • Loading branch information
joergsteffens authored and franku committed Dec 6, 2018
1 parent eb5acd9 commit 9a3d0ff
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 117 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -25,8 +25,7 @@ env:
# Regular expression selects on which branches to run analysis
# Be aware of quotas. Do not run on every branch/commit
- COVERITY_SCAN_BRANCH_PATTERN="master"
# COVERITY_SCAN_TOKEN via "travis encrypt" using the repo's public key
- secure: "J1iNtC34kDcFeeOJ6WcfFyfmRXI0dDgyh+AJvn5d4pBSAVAmkeT74i08ZMEck4Ye97LQB38M5+KSzMXyRP7cv4sB7BjAWLvKbXo90od506/6qmhqfahXa1C/lS4VrQRh48QjvnOP0eYYRP/T90sKSpyINlg48H/l2h7zL6sy5/Q="
# COVERITY_SCAN_TOKEN: is set as secure settings in the travis-ci.org configuration
- COVERITY_SCAN_BUILD_URL="https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh"
- COVERITY_SCAN_BUILD="curl -s $COVERITY_SCAN_BUILD_URL | bash"
# -- END Coverity Scan ENV
Expand Down
24 changes: 19 additions & 5 deletions .travis/all
Expand Up @@ -25,14 +25,14 @@ set -v

BACKUP_TEST_FILE=/usr/sbin/bareos.test

echo -e "status dir" | bconsole
echo
echo "---- label a volume ----"
echo -e "label volume=testvol pool=Full" | bconsole
echo
echo "----- create some file to test backup / restore ----"
echo "bareos restore test" > ${BACKUP_TEST_FILE}
echo
echo -e "status dir" | bconsole
echo
#echo "---- label a volume ----"
#echo -e "label volume=testvol pool=Full" | bconsole
#echo
echo "------ trigger backup job -----"
echo -e "run job=backup-bareos-fd yes\rwait" | bconsole | grep "Job queued. JobId="
echo "status dir" | bconsole
Expand All @@ -42,3 +42,17 @@ echo -e "restore select current\r2\rls\rmark usr\rdone\ryes\rwait" | bconsole
echo "status dir" | bconsole
grep "bareos restore test" /tmp/bareos-restores/${BACKUP_TEST_FILE}

if [ "${BUILD_WEBUI}" ]; then
# show environment
export | grep " TRAVIS"

service apache2 restart
#service apache2 status
export BAREOS_BROWSER="none"
export BAREOS_USERNAME="citest"
export BAREOS_PASSWORD="citestpass"
export BAREOS_CLIENT_NAME="$HOSTNAME-fd"
echo "--------- testing webui over selenium -----------"
echo "configure add console name=citest password=citestpass profile=webui-admin" | bconsole
python ${TRAVIS_BUILD_DIR}/webui/tests/selenium/webui-selenium-test.py -v
fi
17 changes: 12 additions & 5 deletions .travis/travis_before_install.sh
Expand Up @@ -5,10 +5,17 @@ sudo apt-get -qq update
sudo apt-get remove libqt4-dev
cd core
dpkg-checkbuilddeps 2> /tmp/dpkg-builddeps || true
if [ $BUILD_WEBUI ]; then
sudo -H pip install --upgrade pip 'urllib3>=1.22'
sudo -H pip install sauceclient selenium
cd ../webui
dpkg-checkbuilddeps 2>> /tmp/dpkg-builddeps || true
fi
cat /tmp/dpkg-builddeps
sed -e "s/^.*:.*:\s//" -e "s/\s([^)]*)//g" /tmp/dpkg-builddeps > /tmp/build_depends
echo "additional packages required for building:"; cat /tmp/build_depends
sudo xargs --arg-file /tmp/build_depends apt-get -q --assume-yes install fakeroot
dpkg -l
sed -e "s/^.*:.*:\s//" -e "s/\s([^)]*)//g" -e "s/|/ /g" -e "s/ /\n/g" /tmp/dpkg-builddeps > /tmp/build_depends
sudo apt-get -q --assume-yes install fakeroot
cat /tmp/build_depends | while read pkg; do
echo "installing $pkg"
sudo apt-get -q --assume-yes install $pkg
done
true

51 changes: 35 additions & 16 deletions .travis/travis_before_script.sh
Expand Up @@ -9,24 +9,43 @@ print_header()
}

cd core

if [ "${COVERITY_SCAN}" ]; then
# run configure with default options
debian/rules override_dh_auto_configure
eval "$COVERITY_SCAN_BUILD"
else
print_header "build Bareos packages"
fakeroot debian/rules binary

print_header "create Debian package repository"
cd ..
dpkg-scanpackages . > Packages
gzip --keep Packages
ls -la Packages*
printf 'deb file:%s /\n' $PWD > /tmp/bareos.list
sudo cp /tmp/bareos.list /etc/apt/sources.list.d/bareos.list
cd -

print_header "install Bareos packages"
sudo apt-get -qq update
sudo apt-get install -y --force-yes bareos bareos-database-$DB
echo "result: $?"
exit 0
fi


print_header "build Bareos core packages"
fakeroot debian/rules binary


if [ "${BUILD_WEBUI}" ]; then
cd ../webui
# to avoid timestamp conflicts while autoconfiguring we refresh every file
#touch *
print_header "build Bareos webui packages"
fakeroot debian/rules binary
fi


print_header "create Debian package repository"
cd ..
dpkg-scanpackages . > Packages
gzip --keep Packages
ls -la Packages*
printf 'deb file:%s /\n' $PWD > /tmp/bareos.list
sudo cp /tmp/bareos.list /etc/apt/sources.list.d/bareos.list
cd -


print_header "install Bareos core package"
sudo apt-get -qq update
sudo apt-get install -y --force-yes bareos bareos-database-$DB

if [ "${BUILD_WEBUI}" ]; then
sudo apt-get install -y --force-yes bareos-webui
fi
4 changes: 3 additions & 1 deletion README.md
@@ -1,6 +1,9 @@
# <img src="https://raw.githubusercontent.com/bareos/bareos/master/webui/public/img/bareos.png" alt="Bareos" />


[![Build Status](https://travis-ci.org/bareos/bareos.png?branch=master)](https://travis-ci.org/bareos/bareos/branches)
[![Build Status](https://saucelabs.com/buildstatus/bareossaucelabs)](https://saucelabs.com/u/bareossaucelabs)


### Bareos

Expand Down Expand Up @@ -48,4 +51,3 @@ The Bareos project offers two mailing lists: bareos-users and bareos-devel.
### Packages

* [http://download.bareos.org](http://download.bareos.org)

21 changes: 14 additions & 7 deletions webui/tests/selenium/README.md
Expand Up @@ -29,18 +29,25 @@ To run the test you must set certain environment variables:
## Running the test

```
BAREOS_BASE_URL=http://127.0.0.1/bareos-webui/
BAREOS_USERNAME=admin
BAREOS_PASSWORD=linuxlinux
BAREOS_CLIENT_NAME=bareos-fd
BAREOS_RESTOREFILE=/etc/passwd
BAREOS_LOG_PATH=/tmp/selenium-logs/
BAREOS_DELAY=1
export BAREOS_BASE_URL=http://127.0.0.1/bareos-webui/
export BAREOS_USERNAME=admin
export BAREOS_PASSWORD=linuxlinux
export BAREOS_CLIENT_NAME=bareos-fd
export BAREOS_RESTOREFILE=/etc/passwd
export BAREOS_LOG_PATH=/tmp/selenium-logs/
export BAREOS_DELAY=1
python webui-selenium-test.py -v
```

After setting the environment variables you can run the test. Use `-v`option of our test to show the progress and results of each test.

A single test can be performed by:

```
python webui-selenium-test.py -v SeleniumTest.test_login
```


## Debugging

After the test fails you will see an exception that was thrown. If this does not help you, take a look inside the generated log file, located in the same path as your `webui-selenium-test.py` file.

0 comments on commit 9a3d0ff

Please sign in to comment.