-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] added a check in Client to only shutdown the kernel #742
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
Conversation
… if a previous request has been made
I don't like this patch as it feels "unclean". Why not using a SQLite DB in a file? |
I use SQLite specifically because it runs in memory, I have a significant amount of tests, and the performance increase of an in-memory database for testing is very helpful. However, I don't believe this problem is directly related to the Client shutting down the Kernel. My tests using in-memory SQLite worked fine even with the Client shutting down the Kernel. Something else has happened recently that causes the SQLite database to get destroyed. The last commit I worked from where the Client did shutdown the Kernel, but the SQLite database was not reset was d873f21 |
If you don't like this method, can we pass a parameter to the doRequest method to specify whether or not the Kernel should be shutdown? |
@fabpot WebTestCase FrameworkBundle\Client: The minimum to solve that is to remove the boot from createClient, however it's needed in order to get the test client. I can't think of any good solution to that at the moment and i think it's mainly a performance consideration, so feel free to close the PR if you don't think it matters. @Chekote |
In-memory is obviously quite fast, but I think you are going to run into issues in many scenarios with your approach, where tests will fail like you explained above or will start leaking. Also the more complex your schema and fixtures the longer it will take to reinitialize your db. So I recommend this Bundle: Basically when using SQLite it can cache the SQLite db files with your schema+fixtures installed and reuse them instead of having to set things up in memory repeatedly. |
That's a great bundle, it made a big different for me. With the caching of a file based db, my functional test suite is about 30% quicker than using an in memory db. That difference will just get bigger as well as the project keeps growing, thanks! |
Given the existence of FunctionalTestBundle, do you want to close this pull request? |
merged |
This PR was merged into the 2.3 branch. Discussion ---------- fixed bytes conversion when used on 32-bits systems | Q | A | ------------- | --- | Bug fix? | yes (on 32-bits systems) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8977 | License | MIT | Doc PR | n/a This PR reverts #7413 and #742, which does not work well when a number is big (3Go for instance) and the machine is 32bits. Commits ------- b3ae29d fixed bytes conversion when used on 32-bits systems
I had a problem with the Beta1 version with my WebTestCase tests. The pattern i used was to create a client in my test setUp, then populate the database with fixtures, then run my tests. e.g.:
When the actual test ran the database wasn't populated, the container in my controller was a different instance than the container i used to populate the database in the test case. The issue was that the FrameworkBundle Client shuts down the kernel before each request, meaning my in memory sqlite database had disappeared. Another user encountered this as well: http://groups.google.com/group/symfony-users/browse_thread/thread/892d58f7571b3f31#.
The solution I've added is to only shut down the kernel if a request has previously been made. Also in the current state most functional tests will result in the kernel booting twice at the start of a test