Problem/Motivation
#3031379: Add a new test type to do real update testing gives us a new testing framework in Drupal core: BuildTests.
This framework allows for building a site (or a number of sites) within a workspace in the file system, and then using an HTTP server to make requests against it.
This framework was designed to allow 'real' updates between different Drupal versions, as PHPUnit tests.
As a side-effect, we can also perform other build-oriented tests.
Child issues
- #3377981: Add BuildTest for testing Quickstart install and update
- #2962157: TestSiteApplicationTest requires a database despite being a unit test>/li>
- #3377980: Add BuildTest for testing update using Drush
Proposed resolution
Determine which existing tests we wish to perform as build tests.
Convert them.
Remaining tasks
Identify other conversions needed.
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #48 | 3082230-48.patch | 12.38 KB | quietone |
| #48 | 3082230-48.patch | 12.38 KB | quietone |
| #46 | 3082230-46.patch | 12.42 KB | quietone |
| #46 | interdiff.txt | 799 bytes | quietone |
| #43 | 3082230-43.patch | 12.38 KB | quietone |
Comments
Comment #2
mile23Postponed because #3031379: Add a new test type to do real update testing is still in process.
Comment #3
heddnLet's see if one big patch is enough or if we need to bikeshed into multiple sub issues. The interdiff is against what I think is the last patch where all of these things were included in #3031379: Add a new test type to do real update testing.
Comment #4
mile23I'm pretty sure we changed the testing API since those tests were written.
I converted one for documentation and the change record: https://www.drupal.org/node/3082383
Comment #5
heddnThe lint errors was a trailing comma issue when calling into a function. Hopefully this works more better this time on the test bot.
Comment #6
heddnCaught another issue.
Comment #7
heddnComment #8
heddnThis class should probably be abstract.
Comment #9
heddnInstead of the above, the following is what seems to be used on test bots.
Comment #11
heddnThis fixes everything but one failure. Still investigating it.
Comment #13
heddnIts confusing because I can't reproduce the failures on local. But let's try this.
Comment #14
mile23Looking good.
Not so much a review as some comments to maybe steer discussion...
See #3031379-208: Add a new test type to do real update testing item 6.
This used to have more profiles, so if we want this test we should add them back.
So the question here is: Is drush an official way to update, such that we're going to test for it? Also, I'm not sure which version of drush drupalci has, and whether that's the best test or not.
The downside of this test is that it uses quickstart, which might not be a thorough enough test of installation.
I'm not sure why we're changing this file.
Each of these could be a follow-up, assuming we do want to replace them.
Comment #15
heddn14.1-3: done
14.3: I've added all 3 major versions of drush 8,9,10(master). Drush supports chaining so we should cover all the bases this way. And given the strong complaints last time w/ Phar and drush, testing w/ drush is a good idea.
14.4: not addressed
14.5: Drupal\BuildTests\TestSiteApplication\InstallTest will fail in fail patch because I removed the changes to TestSiteInstallCommand. The tests uncovers an existing bug w/ TestSiteInstallCommand that needs to be resolved. See #3031379-114: Add a new test type to do real update testing for more background.
14.6: not addressed
Comment #16
heddnWill pick up the following w/ a later round of feedback.
Unused import.
This should be
->notName('drushrc.php');Comment #18
mile23This looks like a bug that should be a separate issue. Then we even have a legitimate reason to write a new test. :-)
Comment #20
heddn#3087862: TestSiteInstallCommand doesn't work with build tests is now opened. And #3085728: Add access rules for build tests as well. The later has bits of the patch in this meta included in it. So, it does look like we're going the meta route here. Once some of those land, I'll open up a few more follow-ups to catch the rest of the things.
Comment #21
alexpottThis test has to be allowed to fail. And we're not used to dealing with tests that are allowed to fail.
This is cool
This shouldn't be done in this issue. We shouldn't end up with less test coverage.
Comment #22
xjmComment #25
xjmCleaning up leftover beta targets from 9.0.x.
Comment #29
quietone commentedthis is just a reroll, done because #3087862: TestSiteInstallCommand doesn't work with build tests was committed. The new tests are failing locally, but first the reroll.
Comment #30
anchal_gupta commentedI have fixed cs error. please review it
Comment #31
quietone commented@Anchal_gupta, thanks for the interest in the issue. What we both failed to do was to run the code quality checks before uploading the patch. Have a look at the instructions for running the coding standard checks locally so you can be sure the tests will run before uploading a patch.
Comment #33
quietone commentedI get different test results locally. For example, both of these pass locally.
This Drupal\BuildTests\Composer\Component\ComponentsIsolatedBuildTest::testComponentComposerJson with data set #0 ('/Version') fails on the testbot but passes locally.Not sure what the next step is.
Comment #35
quietone commentedRerolling.
Comment #37
quietone commented#16.1 and 2. Done
#18. Not done, added it to the remaining tasks
#21.3 Removed the changes and added the list of test to the remaining tasks.
UpdateSiteDrushTest is failing with:
How to address that?
Comment #40
quietone commentedJust a reroll. And type to run just the Build tests.
Comment #41
quietone commentedI should have known that would not work.
Comment #43
quietone commentedI noticed that other quickstart tests are checking the sqlite version, so I copied that code block to these tests. Also, updated version numbers.
Local testing isn't working for me because I use a personal git hook and that causes failures for chmod. I haven't looked closely but it may be because it is a symbolic link.
Comment #45
quietone commentedI don't know why this is failing with
what it should be non-interactive,
$this->executeCommand('drush site-install --db-url=sqlite://db.sqlite -y');.Comment #46
quietone commentedShow the error output using an assert.
Comment #48
quietone commentedWell, that is a different error than what I get locally.
Comment #50
quietone commentedMoved past that error and on to a new one.
Should it not be using vendor/bin/drush?
DrushInputAdapter was Removed from Drush in 2017.
Comment #51
quietone commentedI moved the Drush test to #3377980: Add BuildTest for testing update using Drush, with links to the core ideas issue about adding drush.
And the quickstart tests to #3377981: Add BuildTest for testing Quickstart install and update
I think Drupal\Tests\Scripts\TestSiteApplicationTest is covered by #2962157: TestSiteApplicationTest requires a database despite being a unit test
Changing to active because the patches have moved to other issues.
This is the only change that is not yet in another issue. This currently an unused property.
Comment #52
quietone commentedAnd there is #2984031: Create Build Tests For Composer and Drupal