Browse Source

Adding docker based unit test execution for mysql utf8mb4

Thomas Müller 8 years ago
parent
commit
9c3f066dab
3 changed files with 36 additions and 1 deletions
  1. 26 1
      autotest.sh
  2. 5 0
      tests/docker/mysqlmb4.config.php
  3. 5 0
      tests/docker/mysqlmb4/mb4.cnf

+ 26 - 1
autotest.sh

@@ -21,7 +21,7 @@ ADMINLOGIN=admin$EXECUTOR_NUMBER
 BASEDIR=$PWD
 
 PRIMARY_STORAGE_CONFIGS="local swift"
-DBCONFIGS="sqlite mysql mariadb pgsql oci"
+DBCONFIGS="sqlite mysql mariadb pgsql oci mysqlmb4"
 
 # $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
@@ -209,6 +209,31 @@ function execute_tests {
             exit 1
         fi
 	fi
+	if [ "$DB" == "mysqlmb4" ] ; then
+		echo "Fire up the mysql docker"
+		DOCKER_CONTAINER_ID=$(docker run \
+			-v tests/docker/mysqlmb4:/etc/mysql/conf.d \
+			-e MYSQL_ROOT_PASSWORD=owncloud \
+			-e MYSQL_USER="$DATABASEUSER" \
+			-e MYSQL_PASSWORD=owncloud \
+			-e MYSQL_DATABASE="$DATABASENAME" \
+			-d mysql:5.7)
+
+		DATABASEHOST=$(docker inspect --format="{{.NetworkSettings.IPAddress}}" "$DOCKER_CONTAINER_ID")
+
+		echo "Waiting for MySQL(utf8mb4) initialisation ..."
+
+		if ! apps/files_external/tests/env/wait-for-connection $DATABASEHOST 3306 60; then
+			echo "[ERROR] Waited 60 seconds, no response" >&2
+			exit 1
+		fi
+		sleep 1
+
+		echo "MySQL(utf8mb4)  is up."
+		_DB="mysql"
+
+		cp tests/docker/mysqlmb4.config.php config
+	fi
 	if [ "$DB" == "mariadb" ] ; then
 		if [ ! -z "$USEDOCKER" ] ; then
 			echo "Fire up the mariadb docker"

+ 5 - 0
tests/docker/mysqlmb4.config.php

@@ -0,0 +1,5 @@
+<?php
+
+$CONFIG = array(
+	'mysql.utf8mb4' => true,
+);

+ 5 - 0
tests/docker/mysqlmb4/mb4.cnf

@@ -0,0 +1,5 @@
+
+[mysqld]
+innodb_large_prefix=true
+innodb_file_format=barracuda
+innodb_file_per_table=true