Problem/Motivation
Speed up testbot and simplify tests by using the testing profile instead of the standard profile.
Steps to reproduce
Proposed resolution
Convert Drupal\node\Tests\NodeAccessBaseTableTest to use the testing profile, not the standard profile.
Remaining tasks
Decide on approach
Review
Commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #55 | test.patch | 12.17 KB | quietone |
| #53 | test.patch | 13.02 KB | quietone |
Issue fork drupal-2254189
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
markdorisonComment #8
volegerComment #9
anya_m commentedRerolled it
Comment #11
anya_m commentedComment #12
andypostComment #19
quietone commentedAdding issue summary and re-parenting.
Comment #20
andregp commentedI used the suggestion from this issue's summary to create this patch. (I basically removed the default theme, so this code would use the test's theme).
I also reverted the change on
run-tests.shas those changes would not be committed to core.Comment #21
andregp commentedComment #23
andregp commentedThe fail is possibly unrelated (as it passed before). The bot will retest it.
Comment #24
smustgrave commentedReading the description this appears to be updating the install profile.
#23 appears to be removing the theme.
Comment #26
smustgrave commentedUpdated test cases since standard isn't being used.
Comment #28
smustgrave commentedComment #30
smustgrave commentedCan't seem to get around this one issue if anyone could help
Comment #31
smustgrave commentedAdding a new test module article_test to avoid using olivero_test for an article content type with all the fields.
I removed some of the cache tags as those modules aren't being tested.so removed them.
Still can't figure out
Comment #32
smustgrave commentedFigured it out! Standard was adding some permissions to the authenticated role that was missing.
Comment #34
smustgrave commentedComment #35
smustgrave commentedbumping as this will unblock others.
Comment #36
joachim commented> Adding a new test module article_test to avoid using olivero_test for an article content type with all the fields.
That seems like a LOT of code to add for just this test.
AFAICT the article_test module duplicates the article content type that the standard profile installs. Which means that this adds a maintenance burden, as the article_test module will need to be kept in sync with future changes to the profile.
If we're needing to test articles, then why not just test the standard profile?
And if we're needing to test something about having a content type with fields, can we do that more simply?
Comment #37
smustgrave commentedThe goal is to not use the full standard install.
There are a number of tests that rely on the article content type with those fields. Figured it would be easier to have them in one place vs having to manually create the content type, fields, form display, etc each time.
Comment #38
joachim commentedIt's a shame we don't yet have profile inheritance :(
What about making a testing profile that's just the article type? There are already profiles called testing_foo in core/profiles.
The advantages would be:
- the files in testing_article would be direct copies of the relevant ones in standard profile. It's therefore easier to keep them in sync
- someone changing the standard profile in future is a bit more likely to notice there is a testing_article profile that they need to update as well, since it's in the same part of the folder structure
Comment #39
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #42
smustgrave commentedComment #44
catchBumping to major - this is one of the slowest Functional tests we have.
Note that #3384936: Use the API to set up languages in tests that are not specifically testing the language form is also open but complementary to this issue.
Comment #45
quietone commentedTrying a new approach here where
BrowserTestBase::setup();is called instead ofparent::setUp()in the setUp method.Comment #48
smustgrave commentedSo I tried fixing the merge conflict in 5601 but got 100s of merge conflicts. So I just started a new one with the exact changes from 5601.
Testing locally I see tests still pass so think @quietone's solution works!
Comment #49
smustgrave commentedJust saw @joachim comment, should investigate.
Comment #50
quietone commentedComment #51
quietone commentedTesting locally without xdebug the test took 3m 33s to run and with this change it was 1m 33s.
Comment #52
smustgrave commentedWow I didn't think it would be much of a difference.
But thanks for checking the comment!
Comment #53
quietone commentedI also wanted to see what this would look like without the phstan-ignore line. For now, I'll upload a patch for the work I did. All the tests changed in the patch pass locally. Is it worth doing that to avoid the ignore line?
Comment #54
smustgrave commentedOnly meant to trigger once but page froze
Comment #55
quietone commentedI fixed the error.
But what do you think of the approach?
Comment #57
quietone commentedI made a new branch for the new approach, attempt3.
Comment #58
catchThat looks like a good approach but a naming nitpick - could we call the new helper
doSetUp()? Just because it more closely matches naming patterns with similar methods that are always called from the same method.Comment #59
smustgrave commentedFor the renaming
Comment #60
quietone commentedRe #58: I agree that doSetup is a better name. I have made that change.
Comment #61
smustgrave commentedI'd thought I'd have time today to get to it but got sidetracked :(
Rename looks good.
Comment #64
catchCommitted/pushed to 11.x and cherry-picked to 10.2.x, thanks!