Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update tracker js files while testing #17155

Closed
wants to merge 2 commits into from
Closed

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jan 27, 2021

Description:

The CustomTrackerJS plugin is enabled by default and tries to update the tracker js files whenever certain events are triggered. Those events include the creation of a site and other events that are triggered a lot while testing.
This PR disables the event listening for that plugin while testing, and only enables it for those tests where it is actually needed.
This should speed up the tests as it also avoids a lot file operations.

Review

  • Functional review done
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@sgiehl sgiehl added c: Tests & QA For issues related to automated tests or making it easier to QA & test issues. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Jan 27, 2021
@tsteur
Copy link
Member

tsteur commented Jan 27, 2021

btw be good to check if this actually speeds up the tests a lot. If it's just a minute or less then it might not be worth it merging as we had issues with it in the past and it can be good to have the tests cover this logic. Eg when a plugin gets activated, and adds tracking code or does something else with tracking code, and then reads a DI config as part of this but because the plugin was earlier not loaded the DI config was not read then it fails. Generally we'd want to to run this code. Or if the file system is slow to write the changes then we could simply store it in memory or so instead of writing it to disk (but then we'd probably also need to read from memory and then things get complicated and might not be worth it).

Copy link
Member

@tsteur tsteur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgiehl do you know how much of a time difference that makes? I'm not 100% sure but I remember some cases where I had found bugs/issues by having these events executed in the tests eg when some dependencies were missing in other plugins that influence the tracker generation etc. If we're not saving too much time it might make sense to keep the logic there or to maybe rather replace file handles with in memory files but whether it's worth the effort would depend on how much time this saves. Generally we want to aim to execute as much of the actual logic during tests as possible.

@tsteur tsteur removed the Needs Review PRs that need a code review label Mar 15, 2021
@diosmosis
Copy link
Member

This doesn't seem to have an effect for any test suite, except the first system test build:

4.x-dev:
image

this pr:
image

(I restarted the 4.x-dev build so it's repeatable.)

This suggests some or one of the core system tests needs this while it's ok to run in other tests. Maybe we can find where specifically it's causing a big problem? Assuming it's better to run as much code as possible during tests.

@sgiehl
Copy link
Member Author

sgiehl commented Mar 22, 2021

@diosmosis I'll simply close this one. Guess the long run time on 4.x-dev was randomly.
The reason for creating this PR was that while debugging some tests I saw that generating the javascript files is triggered very often when setting up a test fixture. That's caused by the events triggered while activating plugins and stuff like that.

@sgiehl sgiehl closed this Mar 22, 2021
@sgiehl sgiehl deleted the nominifyintests branch March 22, 2021 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Tests & QA For issues related to automated tests or making it easier to QA & test issues. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants