Skip to content
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

Enabling bundle causes significant overhead? #446

Open
rpander93 opened this issue Aug 20, 2018 · 2 comments
Open

Enabling bundle causes significant overhead? #446

rpander93 opened this issue Aug 20, 2018 · 2 comments
Labels
Milestone

Comments

@rpander93
Copy link

Hi all,

I'm working on an app using Symfony4.1 and I noticed my testsuite becoming incredibly slow with this bundle enabled. Some debugging showed me that the container is initialized multiple times per test, causing the cache to get recreated also.

I refactored my test to use the WebTestCase provided by Symfony rather than the one provided by this bundle. That already helped somewhat. If I disable the bundle completely in bundles.php, the issue vanishes completely.

In the end, the time required for 1 test class with 2 tests drops from 1.5m to 4s.

Preconditions

  1. Symfony 4.1
  2. PHP 7.2
  3. Bundle version 2.0@alpha

Steps to reproduce

  1. Enable bundle using Symfony Flex
  2. Create functional test extending WebTestCase from this bundle
  3. Execute some tests using the client and grab some services from the container in the test

Expected result

  1. Container should not be recompiled every time.

Actual result

  1. Some debug output in Kernel.php shows me that the container is initialized multiple times and the cache warmer is executed also every time.
@rpander93
Copy link
Author

This is my test class: https://gist.github.com/rpander93/97c37a7b33b0eddd8e76be0f3f83a741

Debugging output by placing some lines in WebTestCase.php and Kernel.php:

Creating kernel for cache: test
Initializing container...
executing cache warmer....
Initializing container...
executing cache warmer....
Creating kernel for cache: test
Initializing container...
executing cache warmer....
Initializing container...
executing cache warmer....

@alexislefebvre alexislefebvre added this to the 2.0 milestone Oct 17, 2018
@alexislefebvre
Copy link
Collaborator

alexislefebvre commented Oct 17, 2018

A possible solution: use traits instead of inheriting from the big test class, see #332 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants