Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2015-07-27 16:41:06 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2015-07-29 11:44:56 +0300
commitea9eabae50dcbd325797b8eda19d7c1fb98faf5d (patch)
tree0dd34e464e3b95981279a02bc6cb8269a24522b3 /autotest.sh
parent4edfadac96fcf267c97371e67e5feccec94b337e (diff)
Add possible use of docker instance for MariaDB
Diffstat (limited to 'autotest.sh')
-rwxr-xr-xautotest.sh55
1 files changed, 44 insertions, 11 deletions
diff --git a/autotest.sh b/autotest.sh
index e9327c8f83e..0e112bfda32 100755
--- a/autotest.sh
+++ b/autotest.sh
@@ -21,7 +21,7 @@ DATABASEHOST=localhost
ADMINLOGIN=admin$EXECUTOR_NUMBER
BASEDIR=$PWD
-DBCONFIGS="sqlite mysql pgsql oci"
+DBCONFIGS="sqlite mysql mariadb pgsql oci"
# $PHP_EXE is run through 'which' and as such e.g. 'php' or 'hhvm' is usually
# sufficient. Due to the behaviour of 'which', $PHP_EXE may also be a path
@@ -127,7 +127,8 @@ fi
echo "Using database $DATABASENAME"
function execute_tests {
- echo "Setup environment for $1 testing ..."
+ DB=$1
+ echo "Setup environment for $DB testing ..."
# back to root folder
cd "$BASEDIR"
@@ -140,11 +141,43 @@ function execute_tests {
cp tests/preseed-config.php config/config.php
+ _DB=$DB
+
# drop database
- if [ "$1" == "mysql" ] ; then
+ if [ "$DB" == "mysql" ] ; then
mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true
fi
- if [ "$1" == "pgsql" ] ; then
+ if [ "$DB" == "mariadb" ] ; then
+ if [ ! -z "$USEDOCKER" ] ; then
+ echo "Fire up the mariadb docker"
+ DOCKER_CONTAINER_ID=$(docker run \
+ -e MYSQL_ROOT_PASSWORD=owncloud \
+ -e MYSQL_USER="$DATABASEUSER" \
+ -e MYSQL_PASSWORD=owncloud \
+ -e MYSQL_DATABASE="$DATABASENAME" \
+ -d rullzer/mariadb-owncloud)
+ DATABASEHOST=$(docker inspect "$DOCKER_CONTAINER_ID" | grep IPAddress | cut -d '"' -f 4)
+
+ echo "Waiting for MariaDB initialisation ..."
+
+ # grep exits on the first match and then the script continues
+ timeout 30 docker logs -f $DOCKER_CONTAINER_ID 2>&1 | grep -q "mysqld: ready for connections."
+
+ echo "MariaDB is up."
+
+ else
+ if [ "MariaDB" != "$(mysql --version | grep -o MariaDB)" ] ; then
+ echo "Your mysql binary is not provided by MariaDB"
+ echo "To use the docker container set the USEDOCKER enviroment variable"
+ exit -1
+ fi
+ mysql -u "$DATABASEUSER" -powncloud -e "DROP DATABASE IF EXISTS $DATABASENAME" -h $DATABASEHOST || true
+ fi
+
+ #Reset _DB to mysql since that is what we use internally
+ _DB="mysql"
+ fi
+ if [ "$DB" == "pgsql" ] ; then
if [ ! -z "$USEDOCKER" ] ; then
echo "Fire up the postgres docker"
DOCKER_CONTAINER_ID=$(docker run -e POSTGRES_USER="$DATABASEUSER" -e POSTGRES_PASSWORD=owncloud -d postgres)
@@ -160,7 +193,7 @@ function execute_tests {
dropdb -U "$DATABASEUSER" "$DATABASENAME" || true
fi
fi
- if [ "$1" == "oci" ] ; then
+ if [ "$DB" == "oci" ] ; then
echo "Fire up the oracle docker"
DOCKER_CONTAINER_ID=$(docker run -d deepdiver/docker-oracle-xe-11g)
DATABASEHOST=$(docker inspect "$DOCKER_CONTAINER_ID" | grep IPAddress | cut -d '"' -f 4)
@@ -176,20 +209,20 @@ function execute_tests {
# trigger installation
echo "Installing ...."
- "$PHP" ./occ maintenance:install --database="$1" --database-name="$DATABASENAME" --database-host="$DATABASEHOST" --database-user="$DATABASEUSER" --database-pass=owncloud --database-table-prefix=oc_ --admin-user="$ADMINLOGIN" --admin-pass=admin --data-dir="$DATADIR"
+ "$PHP" ./occ maintenance:install --database="$_DB" --database-name="$DATABASENAME" --database-host="$DATABASEHOST" --database-user="$DATABASEUSER" --database-pass=owncloud --database-table-prefix=oc_ --admin-user="$ADMINLOGIN" --admin-pass=admin --data-dir="$DATADIR"
#test execution
- echo "Testing with $1 ..."
+ echo "Testing with $DB ..."
cd tests
- rm -rf "coverage-html-$1"
- mkdir "coverage-html-$1"
+ rm -rf "coverage-html-$DB"
+ mkdir "coverage-html-$DB"
"$PHP" -f enable_all.php | grep -i -C9999 error && echo "Error during setup" && exit 101
if [ -z "$NOCOVERAGE" ]; then
- "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$1.xml" --coverage-clover "autotest-clover-$1.xml" --coverage-html "coverage-html-$1" "$2" "$3"
+ "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$DB.xml" --coverage-clover "autotest-clover-$DB.xml" --coverage-html "coverage-html-$DB" "$2" "$3"
RESULT=$?
else
echo "No coverage"
- "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$1.xml" "$2" "$3"
+ "${PHPUNIT[@]}" --configuration phpunit-autotest.xml --log-junit "autotest-results-$DB.xml" "$2" "$3"
RESULT=$?
fi