I am trying to run the full set of standard integration tests, which I want to run before deployments on an continuous integration server. (Whilst developing I will run just for my own module using the methodology [from here][1].)

However I can't get the test database to install. It is throwing:

    [Progress: 423 / 813]
    Module 'Magento_Catalog':
    Installing data...


      [Exception]
      Asymmetric transaction rollback.

What are my steps for debugging? Namely:

 1. How does Magento produce the SQL that it is trying to install?
 2. Is it cached anywhere as a physical file I can read?
 3. How can I find more useful information tracking the problem down?

Here is the full stack trace though I don't think its very useful.

            Exception trace:
     () at /app/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:272
     Magento\Framework\DB\Adapter\Pdo\Mysql->rollBack() at /app/vendor/magento/framework/Model/ResourceModel/AbstractResource.php:99
     Magento\Framework\Model\ResourceModel\AbstractResource->rollBack() at /app/var/generation/Magento/Catalog/Model/ResourceModel/Category/Interceptor.php:908
     Magento\Catalog\Model\ResourceModel\Category\Interceptor->rollBack() at /app/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Category.php:52
     Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Category->addCommitCallback() at /app/vendor/magento/module-catalog-search/Model/Indexer/Fulltext/Plugin/Category.php:29
     Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Category->aroundSave() at /app/vendor/magento/framework/Interception/Chain/Chain.php:67
     Magento\Framework\Interception\Chain\Chain->invokeNext() at /app/vendor/magento/framework/Interception/Chain/Chain.php:63
     Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}() at /app/vendor/algolia/algoliasearch-magento-2/Model/Indexer/CategoryObserver.php:32
     Algolia\AlgoliaSearch\Model\Indexer\CategoryObserver->aroundSave() at /app/vendor/magento/framework/Interception/Chain/Chain.php:67
     Magento\Framework\Interception\Chain\Chain->invokeNext() at /app/vendor/magento/framework/Interception/Interceptor.php:138
     Magento\Catalog\Model\ResourceModel\Category\Interceptor->Magento\Framework\Interception\{closure}() at /app/vendor/magento/framework/App/Cache/FlushCacheByTags.php:60
     Magento\Framework\App\Cache\FlushCacheByTags->aroundSave() at /app/vendor/magento/framework/Interception/Interceptor.php:142
     Magento\Catalog\Model\ResourceModel\Category\Interceptor->___callPlugins() at /app/var/generation/Magento/Catalog/Model/ResourceModel/Category/Interceptor.php:364
     Magento\Catalog\Model\ResourceModel\Category\Interceptor->save() at /app/vendor/magento/framework/Model/AbstractModel.php:631
     Magento\Framework\Model\AbstractModel->save() at /app/vendor/magento/framework/Interception/Interceptor.php:146
     Magento\Catalog\Model\Category\Interceptor->___callPlugins() at /app/var/generation/Magento/Catalog/Model/Category/Interceptor.php:1534
     Magento\Catalog\Model\Category\Interceptor->save() at /app/vendor/magento/module-catalog/Setup/InstallData.php:79
     Magento\Catalog\Setup\InstallData->install() at /app/setup/src/Magento/Setup/Model/Installer.php:844
     Magento\Setup\Model\Installer->handleDBSchemaData() at /app/setup/src/Magento/Setup/Model/Installer.php:796
     Magento\Setup\Model\Installer->installDataFixtures() at n/a:n/a
     call_user_func_array() at /app/setup/src/Magento/Setup/Model/Installer.php:344
     Magento\Setup\Model\Installer->install() at /app/setup/src/Magento/Setup/Console/Command/InstallCommand.php:125
     Magento\Setup\Console\Command\InstallCommand->execute() at /app/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
     Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Symfony/Component/Console/Application.php:874
     Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Symfony/Component/Console/Application.php:195
     Symfony\Component\Console\Application->doRun() at /app/vendor/magento/framework/Console/Cli.php:96
     Magento\Framework\Console\Cli->doRun() at /app/vendor/symfony/console/Symfony/Component/Console/Application.php:126
     Symfony\Component\Console\Application->run() at /app/bin/magento:23


    setup:install [--backend-frontname="..."] [--amqp-host="..."] [--amqp-port="..."] [--amqp-user="..."] [--amqp-password="..."] [--amqp-virtualhost="..."] [--amqp-ssl="..."] [--key="..."] [--session-save="..."] [--definition-format="..."] [--db-host="..."] [--db-name="..."] [--db-user="..."] [--db-engine="..."] [--db-password="..."] [--db-prefix="..."] [--db-model="..."] [--db-init-statements="..."] [-s|--skip-db-validation] [--http-cache-hosts="..."] [--base-url="..."] [--language="..."] [--timezone="..."] [--currency="..."] [--use-rewrites="..."] [--use-secure="..."] [--base-url-secure="..."] [--use-secure-admin="..."] [--admin-use-security-key="..."] [--admin-user="..."] [--admin-password="..."] [--admin-email="..."] [--admin-firstname="..."] [--admin-lastname="..."] [--cleanup-database] [--sales-order-increment-prefix="..."] [--use-sample-data] [--magento-init-params="..."]

     in /app/vendor/magento/framework/Shell.php:61
    Stack trace:
    #0 /app/dev/tests/integration/framework/Magento/TestFramework/Application.php(464): Magento\Framework\Shell->execute('/usr/local/bin/...', Array)
    #1 /app/dev/tests/integration/framework/bootstrap.php(68): Magento\TestFramework\Application->install()
    #2 /app/vendor/phpunit/phpunit/src/Util/Fileloader.php(93): include_once('/app/dev/tests/...')
    #3 /app/vendor/phpunit/phpunit/src/Util/Fileloader.php(77): PHPUnit_Util_Fileloader::load('/app/dev/tests/...')
    #4 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(806): PHPUnit_Util_Fileloader::checkAndLoad('/app/dev/tests/...')
    #5 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(636): PHPUnit_TextUI_Command->handleBootstrap('/app/dev/tests/...')
    #6 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(141): PHPUnit_TextUI_Command->handleArguments(Array)
    #7 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(132): PHPUnit_TextUI_Command->run(Array, true)
    #8 /app/vendor/phpunit/phpunit/phpunit(55): PHPUnit_TextUI_Command::main()
    #9 {main}

    Next Magento\Framework\Exception\LocalizedException: Command returned non-zero exit code:
    `/usr/local/bin/php -f '/app/bin/magento' setup:install -vvv --db-host='database.internal' --db-user='magento2_test_user' --db-password='9PdD*ixRJnQS' --db-name='magento_integration_tests' --backend-frontname='backend' --admin-user='user' --admin-password='password1' --admin-email='[email protected]' --admin-firstname='firstname' --admin-lastname='lastname' --magento-init-params='MAGE_DIRS[etc][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/etc&MAGE_DIRS[var][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var&MAGE_DIRS[media][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/pub/media&MAGE_DIRS[static][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/pub/static&MAGE_DIRS[generation][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/generation&MAGE_DIRS[cache][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/cache&MAGE_DIRS[log][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/log&MAGE_DIRS[session][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/session&MAGE_DIRS[tmp][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/tmp&MAGE_DIRS[upload][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/var/upload&MAGE_DIRS[pub][path]=/app/dev/tests/integration/tmp/sandbox-0-746d38770b4b2d082c0117910a9c0041/pub&MAGE_MODE=developer' 2>&1` in /app/vendor/magento/framework/Shell.php:62
    Stack trace:
    #0 /app/dev/tests/integration/framework/Magento/TestFramework/Application.php(464): Magento\Framework\Shell->execute('/usr/local/bin/...', Array)
    #1 /app/dev/tests/integration/framework/bootstrap.php(68): Magento\TestFramework\Application->install()
    #2 /app/vendor/phpunit/phpunit/src/Util/Fileloader.php(93): include_once('/app/dev/tests/...')
    #3 /app/vendor/phpunit/phpunit/src/Util/Fileloader.php(77): PHPUnit_Util_Fileloader::load('/app/dev/tests/...')
    #4 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(806): PHPUnit_Util_Fileloader::checkAndLoad('/app/dev/tests/...')
    #5 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(636): PHPUnit_TextUI_Command->handleBootstrap('/app/dev/tests/...')
    #6 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(141): PHPUnit_TextUI_Command->handleArguments(Array)
    #7 /app/vendor/phpunit/phpunit/src/TextUI/Command.php(132): PHPUnit_TextUI_Command->run(Array, true)
    #8 /app/vendor/phpunit/phpunit/phpunit(55): PHPUnit_TextUI_Command::main()
    #9 {main}

    === Memory Usage System Stats ===
    Memory usage (OS):	22.57M (564.26% of 4.00M reported by PHP)
    Estimated memory leak:	18.57M (82.28% of used memory)

P.S. I have read @Fabian-Schmengler [question][2] but whilst the thrown error obscuring the root cause is similar, I'm not sure how to apply that knowledge to tracking down the problem with data installation.


  [1]: http://magento.stackexchange.com/questions/93422/creating-integration-tests-for-magento-2-modules
  [2]: http://magento.stackexchange.com/questions/134783/asymmetric-transaction-rollback-error-in-integration-test