I'm having trouble running the magento2 integration tests.

I followed the documentation and set up the database parameters in install-config-mysql.php :

'db-host' => 'mysql:3306',
'db-user' => 'magento2_test',
'db-password' => 'test_user_password',
'db-name' => 'magento2_test',

And when I run phpunit, I get the following:

PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

S.R.......PHP Fatal error:  Uncaught Zend_Db_Adapter_Exception: Port must be configured within host parameter (like localhost:3306 in /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:393
Stack trace:
#0 /var/www/html/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(861): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect()
#1 /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(1189): Zend_Db_Adapter_Abstract->quote('sequence_order_...')
#2 /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(2626): Magento\Framework\DB\Adapter\Pdo\Mysql->showTableStatus('sequence_order_...', NULL)
#3 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Db/Sequence.php(58): Magento\Framework\DB\Adapter\Pdo\Mysql->isTableExists('sequence_order_...')
#4 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Application.php(420): Magento\TestFramework\Db\Sequence->generateSequences()
#5 /var/www/html/dev/tests/integration/framework/Magento/TestFramework/Application.php(436): M in /var/www/html/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 393

=== Memory Usage System Stats ===
Memory usage (OS):      605.15M (100.86% of 600.00M reported by PHP)
Estimated memory leak:  5.15M (0.85% of used memory)

My database runs in a separate container linked to the website container. I can connect to mysql from the website container using cli.

That error seems odd since the port is indeed configured within the host parameter.

I have disabled the memory limit in my phpunit.xml with this line given in the documentation

<ini name="memory_limit" value="-1"/>

What could be wrong with my setup ?

1 Answer 1


Turns out I just needed to set my database container ip instead of 'mysql' in the db-host parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.