This partially blocks #2549013: Remove load plugins.
If we simply remove load plugins and their infrastructure outright, MigrateDrupal6Test breaks because it tries to test dynamic migrations (i.e., migrations which use load plugins, like d6_cck_field_values, d6_term_node, and a couple of others).
What it needs to be doing instead is running the appropriate builders when the migrations are installed to begin with. However, just running the builders in installMigrations() isn't good enough, because builders usually need to read from arbitrary database tables in order to do their thing. If the required tables haven't been loaded up first, things blow up in an inferno of PDO exceptions.
It's also not good enough to simply change the loadDumps() calls to include the tables which the builders will need. Why? Because installMigrations() ham-fistedly installs all available migrations, not just the one(s) to be tested. So all builders would end up running (and failing due to missing tables), even those which have nothing to do with the migrations under test.
There are, then, two options:
- Load all the dump files beforehand so that the builders have all the data they need, up front. This is relatively easy and allows us to remove over 300 lines of code, so that's why I did that in the patch.
- setUp() can manually install the migrations to be tested, load in the dump files required by the builders beforehand. This would take longer, add more code, add another step to the tests' setUp() methods, and be prone to breaking since it's yet another thing to remember.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | interdiff-2550823-0-7.txt | 1.21 KB | phenaproxima |
| #7 | 2550823-7.patch | 57.88 KB | phenaproxima |
| migrate-load_all_tables.patch | 56.72 KB | phenaproxima |
Comments
Comment #2
neclimdulI have a feeling this is going to be a problem. We currently have a "run all migrations together" test which does a similar sort of thing but it is blocking me from making a dump that has a failure in it. This is going to have the same problem, you can only have one d6 install you test, not multiple states.
I would rather have an approach similar to the update system(or just use the same system) where you have a full site in a single dump. We could have on standard fixture that matches this, then specific tests could use specialized fixtures.
This of course would break the "run all migrations" test because any test could use a different fixture so that's a problem but that's what I would like to see.
Comment #3
phenaproximaRewrote the issue summary to include the rationale for this patch, at @neclimdul's request.
Comment #4
phenaproximaComment #5
phenaproximaComment #7
phenaproximaMissed a couple of spots.
Comment #8
benjy commentedThis issue looks fine to me, a bit slower but much less code to manage in tests. I was pleasantly surprised that it was so easy to get green, eg no funky dependencies between dumps and tests.
From speaking with phenaproxima in IRC it sounds like neclimdul (who expressed some concerns) is on board with this so RTBC.
Comment #9
phenaproximaChanging back to NR so it doesn't get committed yet; I'd like to get @neclimdul's sign-off on this first.
Comment #10
neclimdulIt looks fine to me. I'd like to see us standardize on the same approach as update module but we don't need to do that here.
Comment #11
webchickThis seems like the key part of the patch, and it also seems like it's going to make things much more robust in the future. +100.
If it does slow things down an awful lot, we can always roll this back and maybe do a base vs. full distinction like update path tests do, but let's try this for now.
Committed and pushed to 8.0.x. Thanks!