Problem/Motivation
Split from #3412641: OpenTelemetryNodePagePerformanceTest::testNodePageHotCache() is not hot enough.
If you call $this->drupalGet('node/1') you get different behaviour when the tested site is in a subdirectory to when you do $this->drupalGet('/node/1').
See the last two commits on https://git.drupalcode.org/project/drupal/-/merge_requests/6047/commits for an attempt to fix this.
When the the path is node/1 this is resolved to subdir/en/recipes/deep-mediterranean-quiche when it is /node/1 this is resolved to subdir/en/node/1. Note that without the base directory both node/1 and /node/1 are resolved to subdir/en/recipes/deep-mediterranean-quiche.
Steps to reproduce
Proposed resolution
MR 7482 should be reviewed and merged
In core/tests/Drupal/Tests/UiHelperTrait.php strip any forward slash
Remaining tasks
Review
Commit
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Issue fork drupal-3440424
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 #2
alexpottAdding more info to the summary.
Comment #3
catchCreated an MR with the commit from https://git.drupalcode.org/project/drupal/-/merge_requests/6047/commits, which theoretically should have worked but didn't seem to.
Comment #5
catchOne thing I wonder here is:
Do we even want
node/1to be aliased when we pass it to ::drupalGet()? What if I really want to hit the unaliased path? Why not require people to generate the alias before passing it in if they want that behaviour?Comment #6
alexpott@catch - it's all a bit tricky but we rely on code in \Drupal\Tests\UiHelperTrait::buildUrl() to add the base directory and language... see:
Changing this behaviour would be extremely tricky.
I think the current different behaviour for sites with and without a base directory is wrong and should be consistent but I think buildUrl should continue to:
1. Add the base directory
2. And do path processing.
I think we could improve things by making it only set the path_processing option if it is not set. Thereby allowing callers to take control of this.
Comment #7
alexpottThe thing I don't get is why adding
didn't actually fix
OpenTelemetryNodePagePerformanceTest::testNodePageHotCache()- v confused about that.Comment #8
catchYes I'm also very confused about that. Maybe we should do some dump() debugging on gitlab to make sure it's really hitting the URLs we think it is with that change.
Comment #9
alexpottAh I see why it did not work. The code was added in the wrong place. Fixed on the MR attached here. Let's see if something else then fails... this will be interesting.
Comment #10
catchWell, that would explain it.
There is a theoretical risk that tests which previously passed on gitlab ci (and hadn't been run locally for ages) could have started failing with this if they were relying on the non-aliased URL being hit, but since zero core tests are, this is probably fine.
I guess remaining question is whether we look at allowing non-aliased requests per #6 here or open another follow-up for that.
I would also revert the performance test changes here since they may as well be consistent even if we can make them pass without it.
Comment #12
alexpottOpened a new branch for a test-only change because all the changes are in the test system so the magic test-only job doesn't work.
Comment #13
alexpottTests fail as expected... https://git.drupalcode.org/project/drupal/-/pipelines/146418/test_report...
Comment #14
smustgrave commentedUpdated issue summary slightly to include solution and which MR should be committed
The change of stripping the forward slash seems straight forward.
Test-only MR shows coverage
Comment #17
catchI didn't do anything useful here so I think I can commit it.
Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!