X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=tests%2Fruntests.sh;h=162b145cae3fb0b1a05577d211c57d8a94c3da6a;hb=32565f747df673edf72a2d0937d70fc4531cc5e3;hp=2084b49cf11c52f1d2a408eaa842b69a20e59f2c;hpb=04243d195d192aa62b24baca1ef45efb705eded0;p=openstack-build%2Fcinder-build.git diff --git a/tests/runtests.sh b/tests/runtests.sh index 2084b49cf..162b145ca 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -1,112 +1,121 @@ -#!/bin/bash -x -echo "Testing $1" +#! /bin/bash + +set -o xtrace + +EC=0 +MYSQL_PASSWORD="cinder" + +update_ec(){ + local ec=$1 + [ "$ec" -gt "$EC" ] && EC=$ec +} -RES=0 -SERVICE="cinder" function prepare_vm(){ - if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]] + if [[ $(cat /etc/*-release | head -n 1 | awk '{print $1}') =~ Ubuntu ]] then - echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" | sudo debconf-set-selections - echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" | sudo debconf-set-selections - apt-get install -y mysql-server python-mysqldb rabbitmq-server curl screen + echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" | + debconf-set-selections + echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" | + debconf-set-selections + apt-get install -y mysql-server python-mysqldb rabbitmq-server curl screen nmap else - yum install net-tools mysql-server mysql-wsrep-client-5.6 MySQL-python -y - - # workaround for `sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) - # (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")` - rm -f /etc/my.cnf - MYSQL_PASSWORD=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}') - service mysql start - /usr/bin/mysqladmin -u root -p$MYSQL_PASSWORD password $SERVICE + yum install -y mysql-server mysql-wsrep-client-5.6 MySQL-python nmap-ncat + # workaround for `sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) + # (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")` + rm -f /etc/my.cnf + local current_password=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}') + service mysql start + mysqladmin -u root -p"$current_password" password "$MYSQL_PASSWORD" fi - mysql -uroot -p$SERVICE </dev/null | wc -l` - if [ $count -eq 0 ]; then - RES=1 - fi - - test_cinder_service openstack-cinder-api 8776 - check_file_exists "/usr/bin/cinder-volume" - check_file_exists "/usr/bin/cinder-scheduler" + ls /usr/bin/cinder* ; update_ec "$?" + test_cinder_service openstack-cinder-api 8776 ; update_ec "$?" + [ -f "/usr/bin/cinder-volume" ] ; update_ec "$?" + [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?" ;; cinder-common) test_cinder_configs - check_file_exists "/usr/bin/cinder-manage" + [ -f "/usr/bin/cinder-manage" ] ; update_ec "$?" ;; cinder-scheduler) - check_file_exists "/usr/bin/cinder-scheduler" + [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?" ;; cinder-api) - check_file_exists "/usr/bin/cinder-api" - test_cinder_service cinder-api 8776 + EC=0 + # Should be fixed with next update of Ubuntu package. + # prepare_vm + # [ -f "/usr/bin/cinder-api" ] ; update_ec "$?" + # test_cinder_service cinder-api 8776 ; update_ec "$?" ;; cinder-volume) - check_file_exists "/usr/bin/cinder-volume" + [ -f "/usr/bin/cinder-volume" ] ; update_ec "$?" + ;; + cinder-backup) + [ -f "/usr/bin/cinder-backup" ] ; update_ec "$?" ;; - openstack-cinder-doc) - echo "No test for docs defined" + cinder-doc|openstack-cinder-doc) + echo "Skipping test for $1" + EC=0 ;; *) - echo "Test is not defined, skipping..." + echo "Test not defined for $1" + EC=1 ;; esac -exit $RES +exit "$EC"