-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedProgress: needs update
Description
In short
Steps to reproduce
- Magento Test "Magento\TestFramework\Db\Adapter\Mysql" opens a "TransparentTransaction"
- Magento Core "Magento\Framework\DB\Adapter\Pdo\Mysql" opens a normal transaction
- Magento Core "Magento\Framework\DB\Adapter\Pdo\Mysql" rollback the normal transaction
- Magento Core "Magento\Framework\DB\Adapter\Pdo\Mysql" opens a new normal transaction
- this causes an error because rollback isn't complete
- getTransactionLevel() returns "0" but the value of "$this->_transactionLevel" is "1"
In detail
Preconditions
- Magento 2.1.6
- PHP 7.0.20
- MySQL 5.5.55
Steps to reproduce
- I wrote a Rest service which delegates bundled requests to the corresponding Rest Resource.
- To test this service I used the Integration Test FW.
- So I tried to handle two request in one method call:
- Create an allready existing Admin User
- Update an existing Admin User
Expected result
I expected that this method returns the following result:
- Create faild > Magento\Framework\Validator\Exception : A user with the same user name or email already exists.
- Successfully updated the user
Actual result
- But what I get is:
- Create failed > Magento\Framework\Validator\Exception : A user with the same user name or email already exists.
- Update failed > Exception: Rolled back transaction has not been completed correctly.
- The corresponding exceptions are:
- Magento\Framework\Validator\Exception: A user with the same user name or email already exists.
#0 /var/www/magento/var/generation/Netresearch/RolesManagement/Model/User/Interceptor.php(960): Magento\Framework\Model\AbstractModel->validateBeforeSave()
Can you commit to repository a folder dev/tests/static ? #1 /var/www/magento/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(395): Netresearch\RolesManagement\Model\User\Interceptor->validateBeforeSave()
BUG FIX - Uncaught exception when accessing admin with none existent use... #2 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(392): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Netresearch\RolesManagement\Model\User\Interceptor))
__DIR__ Typo fixed #3 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(365): Netresearch\RolesManagement\Model\Rest\V1\UserResource->updateUserModel(Object(Netresearch\RolesManagement\Model\Rest\V1\Data\User), Object(Netresearch\RolesManagement\Model\User\Interceptor))
Enable Magento_Profiler by SetEnv #4 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(148): Netresearch\RolesManagement\Model\Rest\V1\UserResource->createUserModel(Object(Netresearch\RolesManagement\Model\Rest\V1\Data\User), Object(Netresearch\RolesManagement\Model\User\Interceptor))
Enable automated CRUD setup for Adminhtml Grids #5 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(218): Netresearch\RolesManagement\Model\Rest\V1\UserResource->put('Test01234-2', Object(Netresearch\RolesManagement\Model\Rest\V1\Data\User))
Why use private for message ? #6 /var/www/magento/vendor/netresearch/roles-management/Test/Integration/Api/Rest/V1/UserResourceInterfaceTest.php(408): Netresearch\RolesManagement\Model\Rest\V1\UserResource->postList(Array)
Ability to provide configuration for different environments in app/etc/local.xml #7 [internal function]: Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest->testPostList()
Clear separation for Controller and controllers required with Full Controller path #8 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(1054): ReflectionMethod->invokeArgs(Object(Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest), Array)
Added: dispatchEvent to deleteAction(). Only existed in massDeleteAction(). #9 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(905): PHPUnit_Framework_TestCase->runTest()
Merged JS/CSS improvements #10 phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php(686): PHPUnit_Framework_TestCase->runBare()
Design suggestion for cross browser compitablity #11 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(860): PHPUnit_Framework_TestResult->run(Object(Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest))
core/template block should use a helper or a model #12 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(722): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
Performance Testing #13 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(722): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
Adding dispatch of an event before and after applyAllUpdates() #14 phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php(517): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
Decrease dependencies from Mage class #15 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(186): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array, true)
Block must know nothing about his parent #16 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(116): PHPUnit_TextUI_Command->run(Array, true)
Move validation of Mage_Customer_Model_Address to another class #17 /usr/local/bin/phpunit(584): PHPUnit_TextUI_Command::main()
MCACE-136 - Catalog API call assignProduct does not pass $identifierType... #18 {main} - Exception: Rolled back transaction has not been completed correctly.
#0 /var/www/magento/vendor/magento/module-resource-connections/DB/Adapter/Pdo/MysqlProxy.php(203): Magento\Framework\DB\Adapter\Pdo\Mysql->beginTransaction()
Can you commit to repository a folder dev/tests/static ? #1 /var/www/magento/vendor/magento/framework/Model/ResourceModel/AbstractResource.php(49): Magento\ResourceConnections\DB\Adapter\Pdo\MysqlProxy->beginTransaction()
BUG FIX - Uncaught exception when accessing admin with none existent use... #2 /var/www/magento/vendor/magento/framework/Model/ResourceModel/Db/AbstractDb.php(386): Magento\Framework\Model\ResourceModel\AbstractResource->beginTransaction()
__DIR__ Typo fixed #3 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(392): Magento\Framework\Model\ResourceModel\Db\AbstractDb->save(Object(Netresearch\RolesManagement\Model\User\Interceptor))
Enable Magento_Profiler by SetEnv #4 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(365): Netresearch\RolesManagement\Model\Rest\V1\UserResource->updateUserModel(Object(Netresearch\RolesManagement\Model\Rest\V1\Data\User), Object(Netresearch\RolesManagement\Model\User\Interceptor))
Enable automated CRUD setup for Adminhtml Grids #5 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(171): Netresearch\RolesManagement\Model\Rest\V1\UserResource->createUserModel(Object(Netresearch\RolesManagement\Model\Rest\V1\Data\User), Object(Netresearch\RolesManagement\Model\User\Interceptor))
Why use private for message ? #6 /var/www/magento/vendor/netresearch/roles-management/Model/Rest/V1/UserResource.php(208): Netresearch\RolesManagement\Model\Rest\V1\UserResource->putList(Array)
Ability to provide configuration for different environments in app/etc/local.xml #7 /var/www/magento/vendor/netresearch/roles-management/Test/Integration/Api/Rest/V1/UserResourceInterfaceTest.php(408): Netresearch\RolesManagement\Model\Rest\V1\UserResource->postList(Array)
Clear separation for Controller and controllers required with Full Controller path #8 [internal function]: Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest->testPostList()
Added: dispatchEvent to deleteAction(). Only existed in massDeleteAction(). #9 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(1054): ReflectionMethod->invokeArgs(Object(Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest), Array)
Merged JS/CSS improvements #10 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(905): PHPUnit_Framework_TestCase->runTest()
Design suggestion for cross browser compitablity #11 phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php(686): PHPUnit_Framework_TestCase->runBare()
core/template block should use a helper or a model #12 phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php(860): PHPUnit_Framework_TestResult->run(Object(Netresearch\RolesManagement\Test\Integration\Api\Rest\V1\UserResourceInterfaceTest))
Performance Testing #13 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(722): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
Adding dispatch of an event before and after applyAllUpdates() #14 phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php(722): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
Decrease dependencies from Mage class #15 phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php(517): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
Block must know nothing about his parent #16 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(186): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array, true)
Move validation of Mage_Customer_Model_Address to another class #17 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(116): PHPUnit_TextUI_Command->run(Array, true)
MCACE-136 - Catalog API call assignProduct does not pass $identifierType... #18 /usr/local/bin/phpunit(584): PHPUnit_TextUI_Command::main()
Allow module dependencies to not be "hard" dependencies. #19 {main}
- Magento\Framework\Validator\Exception: A user with the same user name or email already exists.
Suggestion
The class variable "$this->_transactionLevel" shouldn't used directly. I think it's better to use getTransactionLevel() and add some protected methods e.g. "increaseTransactionLevel()" and "decreaseTransactionLevel()". This should avoid that problem, because you can override this methods inside Magento\TestFramework\Db\Adapter\Mysql.
bnymn
Metadata
Metadata
Assignees
Labels
Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchCannot reproduce the issue on the latest `2.4-develop` branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedProgress: needs update