Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
simpletest.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Sep 2012 at 12:31 UTC
Updated:
29 Jul 2014 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
andypostPatch fixes WebTestBase->setUp()
Comment #2
andypostTables are not found because sqlite does not uses prefixes for tables but creates new database with
.ht.sqlite-simpletest289381namesSo WebTestBase->tearDown() does not find a tables with
$tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');codeComment #3
andypostA sqlite makes new database file for each test* so it needs to cleanup it.
Patch just isolates table clean-up to allow test runs
Comment #4
agentrickardWould this work so we don't have SQLite-specific exception handling?
Comment #5
andypostI fount that dont because sqlite db_find_tables() returns not only a drupal-related tables but some internal (sqlite_sequences for example) and loop that deletes tables can't delete some of them and sometimes stops to delete them because implementation to search tables are different for db_drop_table and db_find_tables
Comment #6
sun1) I no longer know why I assigned the database settings manually, instead of just assigning the entire $connection_info['default'] as form values to submit to $edit. We should probably do that instead.
2) If db_find_tables() returns internal/native tables on sqlite, then we need to fix the database driver, instead of hacking around it in a single spot.
Comment #7
webchickSorry, but if the title of this issue is true, this is at least major.
Comment #8
damien tournoud commentedThere is another issue for prefixed database files failing to be cleaned-up on SQLite after testing. That is supposed to work (we have code in __destruct() of the SQLite implementation for that), but it seems to have been broken somewhere along the way.
Comment #9
chx commentedNote that sqlite (and postgresql) will likely remain in this half-supported state until the new test infrastructure happens and we have test bots for them. This is a fact.
Comment #10
damien tournoud commentedAs far as I know, this is not a SQLite bug.
Comment #11
andypostI still think that sqlite implementation has some troubles because looping through tables for delete mostly always fails
Comment #12
lotyrin commentedI think this is certainly a bug in Drupal's SQLite abstraction.
Everywhere in core we make the assumption that database table prefixes are database table prefixes (we don't have a generic namespacing interface that can be backed however it wants) SQLite violates that assumption and uses attached databases.
We could eventually change the db abstraction to add methods like "Create namespace" "Destroy namespace" or the like, but that's not the current case.
Because Simpltest (rightfully) assumes that it's dealing with table prefixes, it searches for and drops tables, but the sqlite abstraction layer fails to behave properly, and instead leaks its internal implementation details.
Comment #13
lotyrin commentedActually, in order to allow for some progress to be made on setUp(), for which we have a solution in SimpleTest, I'm moving the tearDown() issue to another ticket (as it's possible the fix will be out in sqlite abstraction rather than simpletest.) New issue is here: #1814706: WebTestBase->tearDown() broken for sqlite
Comment #14
lotyrin commentedAnd here's my patch for this issue.
It matches sun's suggestion in #6
Comment #15
sunThanks, simple and passes tests; looks good to me.
Comment #16
andypost+1 rtbc!!! Manually testing sqlite and it works, also there's no tearDown() exception
Comment #17
andypostjust a re-roll because applies with offset
Comment #18
dries commentedLooks good, and actually simplified things. Committed to 8.x. Thanks.
Comment #19
lotyrin commentedI'm not seeing the tearDown problem anymore either. I guess I'll close that issue.