-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict with dama/doctrine-test-bundle #423
Comments
I use both those bundles, but I do not use the backup system for the fixtures. I still (sometimes) have this issue. I'll try to investigate this further. |
Additions, in my case:
|
@Jean85 Do you have exactly the same issue? It's kinda weird, I don't use parallel testing and the rollback did "fix" the issue. 🤔 |
I did a git bisect of this package and it seems this commit brake my tests: 5923bed. I don't know how yet, but I can confirm it's related to #398 now. @alekseytupichenkov @alexislefebvre do you have any idea of how to provide a quickfix? Otherwise, I would suggest to revert it for now. |
Thanks for the bisect @soullivaneuh ! Looking at the diff, I think that the issue is in the Which fixture functionality are you using from the Liip bundle? |
Certainly because the table related operation are not managed for rollback. Plus, as I can see, the proposed feature is more or less the same as dama proposed. But I need dama for other non-functionnal tests.
What do you mean by that? I use Alice v3, is that you wanted to know? |
Yes, it's what I wanted to know; specifically, I would like to know which fixture features do you trigger, because I use none of those. In my case, I'm probably creating some race condition in the transactions, and since the connection stays the same in consequent tests, one of the transaction fails. I fear that the definitive fix should be done in the DAMA bundle... |
Well, I don't use extra configuration. Here is my namespace Tests\AppBundle\Controller;
use Liip\FunctionalTestBundle\Test\WebTestCase as BaseTestCase;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;
abstract class WebTestCase extends BaseTestCase
{
/**
* @var mixed[]
*/
private $fixtures;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->fixtures = $this->loadFixtureFiles(\array_merge([
__DIR__.'/../../fixtures/orm/country.yml',
__DIR__.'/../../fixtures/orm/group.yml',
__DIR__.'/../../fixtures/orm/user.yml',
__DIR__.'/../../fixtures/orm/user_browser.yml',
__DIR__.'/../../fixtures/orm/organization.yml',
__DIR__.'/../../fixtures/orm/api_key.yml',
], $this->getFixturesFiles()));
}
/**
* @return string[]
*/
protected function getFixturesFiles(): array
{
return [];
}
// Not related stuff.
} As you can see, just providing yaml fixtures files. And here is the configurations of this bundle, nelmio and dama: liip_functional_test:
authentication:
username: user_default
password: test
command_verbosity: normal
command_decoration: false
nelmio_alice:
locale: fr_FR
seed: '%seed%'
dama_doctrine_test:
enable_static_connection: true
enable_static_meta_data_cache: true
enable_static_query_cache: true For dama, I think it's the default configuration generated by Flex. Here is also my <?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false"
syntaxCheck = "false"
bootstrap = "tests/bootstrap.php"
>
<php>
<env name="RESET" value="0" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="0" /> <!-- https://github.com/symfony/symfony/pull/24867 -->
<env name="APP_ENV" value="test"/>
<server name="KERNEL_CLASS" value="App\Kernel" />
</php>
<listeners>
<listener class="\DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" />
</listeners>
<testsuites>
<testsuite name="Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
</phpunit> |
Well, then the cause (at least for you) is the |
I'm on other issue right now, but I'm also pretty sure it's related to the This is why I'm asking for a way to disable it. ;-) |
@Jean85 interesting issue... feel free to create an issue on my bundle and I would be happy to look into it 😉 @soullivaneuh I'm also pretty sure its the TRUNCATE/ALTER queries. See dmaicher/doctrine-test-bundle#58 (comment) |
Hi all, so, is this actual issue? Or all fixed in dmaicher/doctrine-test-bundle#58 (comment) |
@powerpd doctrine-test-bundle is not a problem. This, is the real issue. |
Hi, sorry for long response
I think, in this case, better way is add some settings for enable/disable database schema changes? Because using SAVEPOINT with changing database schema is not good idea @soullivaneuh @Jean85 what is yours opinion? |
I reproduced it locally and in case when I remove this lines all's work fine |
I don't think there's a way to disable them at low level. Only way would be to inspect every query for those actions, but I don't even know if it's feasible. |
I think we can't check every query, and maybe it's not necessary
|
OR I can stay just one method |
I started writing PR, so this is example how it will be: |
@alekseytupichenkov I'll try your PR to see if it fix my issue. @alexislefebvre Bunch of release was done and this issue is still actual. Could we consider a revert of #398 or a impler way to disable it waiting a proper fix? |
Hi @soullivaneuh In case of it is important, as fast fix I can commenting this lines |
I partially agree with you @alekseytupichenkov. Indeed, the conflict with other library should not be your problem. This is why I'm also suggesting on option to disable the feature. So it will be working for everyone. 👍 |
I would prefer a way to disable the feature instead of reverting the numerous changes from #398. @alekseytupichenkov started to work in #462 and I would prefer to use a simple solution a release beta and stable versions before the end of this year. |
It looks like DAMADoctrineTestBundle and LiipFunctionalTestBundle do the same thing, which leads to a conflict ultimately. I'm wondering if we could rely on dama/doctrine-test-bundle for database and schema creation? We may remove the code from LiipFunctionalTestBundle that perform the same operations than DAMADoctrineTestBundle. But it would force users to install DAMADoctrineTestBundle, it means that it would:
|
Hi @alexislefebvre, I want clarify DAMADoctrineTestBundle and LiipFunctionalTestBundle don't do the same thing. |
technically not correct 😉 But apart from that 👍 |
Exactly, DAMADoctrineTestBundle is just an easy way to rollback your database statement after each test. |
I added a test environment in #471 where The test class inherits from https://github.com/liip/LiipFunctionalTestBundle/blob/2.x/tests/Test/WebTestCaseConfigMysqlTest.php so it launches the same tests. |
Does anyone have any idea to replicate the issue with DAMADoctrineTestBundle? The test added in #471 should fail but it doesn't, and I don't understand why. |
Issuing commands like |
Thanks for your answer @Jean85. I can add a check that the data is rolled back but I would like to replicate the error reported in this issue, so we could then try to fix it. |
I think the philosophy of fixtures loading of thoses two bundles (dama & liip) are incompatible and cannot really be mixed. Indeed this bundle allows you to specify a different set of fixtures for every tests (at least I'm using |
I found a simple workaround in another project: laravel/framework#18429 (comment) If we call Update: it doesn't always work, on my local environment it works after I delete the Symdony cache. 🤔 |
You're right, I'll stop searching for a solution and accept that we can't use the 2 bundles in the same time. I created a PR to explain this: liip/LiipTestFixturesBundle#3 |
@alexislefebvre May we consider this? With an note on the readme, it would allow to use both, accepting not using some part of the liip bundle. In my case, I need both for different test case, but I can't really separate as dama listener is loaded from the PHPUnit configuration. Except if you have a magic workaround for me? :-) Regards |
Thanks for the reminder, I forgot this option. I'll try to find a way. |
I can replicate the issue in a different project, the error disappears if I disable the static connection:
If this temporary solution works, we can merge liip/LiipTestFixturesBundle#11 |
I still don't understand why there's no error when I run internal tests with DAMADoctrineTestBundle as in liip/LiipTestFixturesBundle#10, but if I put the same configuration in a project, I have the same error than in the issue. 🤔 |
Disabling |
Well, that's still better than an exception 😉 |
@soullivaneuh Could you please try the change added on the PR liip/LiipTestFixturesBundle#15?
|
liip/LiipTestFixturesBundle#15 has been merged, you can disable automatic creation of database in the last release of LiipTestFixturesBundle: https://github.com/liip/LiipTestFixturesBundle/releases/tag/1.1.0 |
Sorry @alexislefebvre I didn't get the time to test. So if I well understand, I have to migrate to v3 with the new test-fixtures bundle to get the fix? |
No problem. :)
Exactly, then you'll be have a setting to disable changes related to database and schema: https://github.com/liip/LiipTestFixturesBundle/blob/836599c15fa6d7333aef1a60f68f3c55fe5ca7ae/doc/caveats.md |
I'll give a try on my next project upgrade section, thanks! |
Hi, I also experienced this conflict with DAMA and Liip bundles with the same problem. I am using 1.9.1 version of the LiipFunctionalTestBundle. |
Since the update to
2.0.0-alpha4
, I have the following error on each integration test:First, I was thinking about a DoctrineTestBundle issue, so I gave more reports in dmaicher/doctrine-test-bundle#58.
But I didn't update this bundle and the issue does not exist anymore if I rollback to
2.0.0-alpha3
version of your bundle.I suspect the backup/restore services introduced in #398 to cause side effects to doctrine-test-bundle, but I didn't get into investigation yet.
What do those services? Probably same things? There is a way to deactivate them?
Regards.
The text was updated successfully, but these errors were encountered: