#!/bin/bash -x echo "Testing $1" RES=0 SERVICE="cinder" function prepare_vm(){ 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 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 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" ;; cinder-common) test_cinder_configs check_file_exists "/usr/bin/cinder-manage" ;; cinder-scheduler) check_file_exists "/usr/bin/cinder-scheduler" ;; cinder-api) check_file_exists "/usr/bin/cinder-api" test_cinder_service cinder-api 8776 ;; cinder-volume) check_file_exists "/usr/bin/cinder-volume" ;; openstack-cinder-doc) echo "No test for docs defined" ;; *) echo "Test is not defined, skipping..." ;; esac exit $RES