Problem/Motivation
Drupal 7 core tests don't pass with SQLite.
It'd be useful if they did so that we can ensure changes made to database-related code for one RDMS don't break others (for example #2978575: Mysql 8 Support on Drupal 7).
This may be especially important after D7 EoL when the full d.o drupalci infrastructure will likely not be available for D7 testing.
Steps to reproduce
Run core tests with a SQLite database.
Proposed resolution
Fix the test failures.
Remaining tasks
Review and commit the following:
Touches shared db code / code outside of SQLite driver
- #1713332-92: The SQLite database driver fails to drop simpletest tables (required for drupalci tests to work at all)
Only changes are within the SQLite driver
- #3172877-8: Enable WAL journal mode by default for SQLite database [D7 backport] (required for drupalci tests to work at all)
- #2427875-11: SQLite Insert query does not account for INSERT FROM ... SELECT.
Changes tests only
- #3173219-4: D7 SQLite testing - IPAddressBlockingTestCase
- #3173220-3: D7 SQLite testing - FieldSqlStorageTestCase
- #3174134-2: Fix skipping of ConnectionUnitTest for non-MySQL dbs
The combined patch in #15 has all 6 of the patches above, and tests are passing with all versions of PHP / MySQL / SQLite we've tried.
Review can stop here.
Maybes / follow-ups:
Done:
#3173146: D7 CI failure with SQLite db using WAL - needed to actually get tests to run properly on drupalci with SQLite + WALthis is now deployed
User interface changes
n/a
API changes
n/a ?
Data model changes
n/a ?
Release notes snippet
tbc
Comment | File | Size | Author |
---|---|---|---|
#24 | 3172878-24_noop.patch | 323 bytes | mcdruid |
Comments
Comment #2
mcdruidComment #3
mcdruidComment #4
mcdruidThere's a patch in #3173146: D7 CI failure with SQLite db using WAL which I think allows D7 tests to run properly in drupalci with WAL enabled for SQLite.
With that in place on a local drupalci set up the tests for #3172877-5: Enable WAL journal mode by default for SQLite database [D7 backport] ran with only these failures:
So with any luck, those are the only other problems that we'll need to look at fixing; they should each have their own issue.
Comment #5
izmeez CreditAttribution: izmeez commented@mcdruid You are doing an amazing job.
Comment #6
mcdruidAdded child issues for the 3 failing tests.
Comment #7
mcdruid@izmeez awww, thank you - appreciate that!
Comment #8
mcdruidComment #9
mcdruidComment #10
mcdruidComment #11
mcdruidComment #12
mcdruidIt's a bit unusual to do this, but here's a patch which combines all 5 patches from the list in the IS:
The reason for doing this is that the first 2 in the list are required to actually have drupalci test SQLite patches successfully.
Once those two are committed, we can test the others normally.
With any luck though, this combined patch should demonstrate all tests passing successfully.
Comment #13
mcdruidOk, looks like there are at least two problems:
1) Looks like SQLite testing is a still a bit fragile:
https://www.drupal.org/pift-ci-job/1837005
AFAICS that may be due to concurrency. I can't really think what else would cause it to happen intermittently.
As the SQLite tests are very fast when they do work successfully, I wonder if we could dial down the concurrency and make them more reliable? I'll talk to @mixologic about it.
2) I've not seen this one before:
...along with 4 of these:
AFAICS that test should be skipped for anything other than MySQL (SQLite doesn't have a
CONNECTION_ID()
function so this is never going to work):https://git.drupalcode.org/project/drupal/-/blob/7.73/modules/simpletest...
So I'm not really sure why this code is running in the first place.
#3128880: Make ConnectionUnitTest also run for PostgreSQL is sort of relevant but doesn't have anything we can backport for SQLite.
Comment #14
mcdruidComment #15
mcdruidFiled #3174121: Intermittent errors with D7 SQLite tests to suggest running drupalci with a lower concurrency for D7 / SQLite.
Adding 3174134-2.patch to the combined patch (also added the issue to the IS).
Again, no interdiff as that new patch would be it.
Comment #16
joseph.olstadnice work!
100% success.
Comment #17
MixologicIf there are intermittent errors with high concurrency, that reveals a bug with the sqlite db implementation, and isnt something that should be 'fixed' by dialing down the testbot concurrency.
Comment #18
joseph.olstad@Mixologic , might be due to the fact that the previous run was only a partial patch
the full combined patch in #15 seems ok.
Comment #19
mcdruidThe first test run in #12 hit an exception ( https://www.drupal.org/pift-ci-job/1837005 ) which went away with a re-run, so with that small sample size, I'd call it an intermittent problem.
I won't argue that it reflects the fact that D7 might not handle a lot of db churn with high concurrency using SQLite, and I can see the point of view that we shouldn't try to avoid that by being gentler with the testbot :)
I don't think improving that's going to be a high priority any time soon, but patches always welcome!
In the meantime, it looks like we might have been unlucky and hopefully it'll work most of the time (and will eventually succeed with a rerun or two), so I think this is a definite improvement to D7's test coverage.
We'll work on getting the patches reviewed and committed.
Comment #20
mcdruidTidied IS to make this easy to review.
Comment #21
mcdruidComment #22
mcdruidLooks like tests are passing with all versions of PHP / MySQL / SQLite we've tried (bar the odd testbot hiccup, typically solved by a re-run).
Comment #23
joseph.olstadI just quickly went through the patch line by line.
It looks good to me, some test changes revolving around table prefixes had to look closely but the changes look good afaik.
It's definately an improvement.
The db api is a work in progress so I'd say put this into 7.x dev branch and continue working on the mysql 8 issue which will get a lot more people testing and already has some of its own test coverage.
Thanks!
Comment #24
mcdruidJust committed what's hopefully the last patch on the list to get this working.
Here's a noop patch to confirm that D7 core now passes tests with SQLite.
Comment #25
mcdruidYup, looks like tests pass in SQLite and MySQL now.
Nice. Thanks for your help everyone.
Comment #26
joseph.olstadGreat work @mcdruid, Thanks!
Comment #27
joseph.olstadMy appologies if I get your name mixed up with McDavid a lightning fast hockey player. I just caught myself on it.
Comment #28
joseph.olstad@mcdruid , one important thing we need to do now, can you please add automated sqlite testing to this page:
https://www.drupal.org/node/3060/qa
this should run on commit!
Comment #29
mcdruidYup, thanks @joseph.olstad I'd planned on adding SQLite tests on commit - I just added it.
I prefer all lowercase, but no big deal :)
Thanks for your help!
Comment #30
joseph.olstadThanks for that!
Lol, I was referring to this Mc: