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

Command icon 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

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Assigned: claudiu.cristea » Unassigned
Issue summary: View changes
Status: Active » Needs review

I 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.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

There was conversation in slack that we didn't need to add tests for the test changes here. All looks good. LGTM.