Problem/Motivation
While implementing a performance test for a project, using PerformanceTrait, I'm hitting this error:
TypeError: strlen(): Argument #1 ($string) must be of type string, false given/var/www/html/web/core/tests/Drupal/Tests/PerformanceTestTrait.php:406
The problem is that my site loads external CSS/JS which have specific access policies making them unavailable in the testing environment (403). It's not in the scope here to debate why they are doing this, this could happen for various reasons.
Steps to reproduce
From the page requests an external CSS asset that return 403.
Proposed resolution
EITHER,
Check if a valid string has been returned when GETing the CSS/JS assets and ignore that asset if not,
OR,
Allow a list of regex patterns of URLs to be bypassed in \Drupal\Tests\PerformanceTestTrait::collectNetworkData().
Probably, the later is more solid because it allows to have the same baseline every test run while the first option might have temporary random behavior.
Remaining tasks
Decide the way to go. EDIT: Discusses with @catch to go with the 2nd option.
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Issue fork drupal-3633416
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
claudiu.cristeaI had a discussion with @catch on Slack and it was decided to follow the 2nd option. It was also agreed that probably this doesn't need tests.
Comment #4
heddnThere was conversation in slack that we didn't need to add tests for the test changes here. All looks good. LGTM.