Closed (fixed)
Project:
SimpleTest
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
4 Apr 2008 at 23:18 UTC
Updated:
22 Apr 2008 at 05:33 UTC
Jump to comment: Most recent file
When a test crashes due to a PHP error that doesn't let the tearDown method run it leaves the prefix tables in the database.
I have created a patch that checks for any left over tables and deletes them when simpletest_entrypoint function is called.
My only concern is that it may not run in non-MySQL databases, but I don't know for sure.
Comments?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | simpletest_db_cleanup.patch | 3.24 KB | boombatower |
| simpletest_db_cleanup.patch | 864 bytes | boombatower |
Comments
Comment #1
chx commentedSELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name LIKE 'simpletest%'is the code to run on postgresql.Comment #2
chx commentedThis needs to be a separate page. We are passing the prefix in the reuqest so that the same Drupal install can run multiple tests at the same time. If you drop every table beginning with simpletest, this won't happen.
Comment #3
boombatower commentedI tried to add a button that could be pressed and then the database would be cleaned, but for some reason it never invokes the form_submit hook.
Comment #4
boombatower commentedMade a button on the tests page that can be pressed and the specified query run.
Committed.
Comment #5
chx commentedYou only commented the postgresql query. There is no trace of the mysql query. Are we the first to make a module that only works with postgresql :D ?
Comment #6
boombatower commentedThe query works for me on MySQL. I thought that it works for both since you said it would work on postgresql.
Let me know.
Comment #7
chx commentedWell, this needs complete rework. Store the tables (coming from schema) with a timestamp and after, say, an hour, clean up automatically. No introspection. No button to press. And yet, you can happily run multiple requests at the same time. As noted in the other issue: we can pass the original db_prefix in the user_agent too, switch back to the original database and store there.
Comment #8
dlangevin commentedThat seems a little overly complex to me. Can we assume that all db tables with the prefix simpletest are from tests that died before tearDown() and just remove them with cron? Why do you think we should store this in the db?
Comment #9
boombatower commentedI'm not sure that having a some sort of time interval will do much good since we don't know how long the tests may take to run. From what I understand the tests easily take an hour+ to run, so automatic deletion would have some issues. Similar issue with cron.
The tables shouldn't ever be left over on the test server since that will only occur if a PHP error causes the test to completely crash or some other catastrophic failure. I suppose that could happen if someone submits a patch with a syntax error. Not really sure, but in that case maybe the testing box should reset itself between test patch (which I think was already in the plan).
The intention of the button was to make it easy when writing tests to cleanup database which I run into somewhat often.
Comment #10
chx commentedSo, MySQL 5.0 has information_schema and all is well. Indeed, it does not worth the bothering to do automated cleanup.
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.