-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Cache request responses in UI tests to avoid some external requests #21492
base: 5.x-dev
Are you sure you want to change the base?
Conversation
Interesting approach. So we're basically saying the back-end might be slow so we store and reuse the processed responses. In principle I don't have a problem with this but it might complicate debugging later on when someone tests things locally and changes some data and expects that to be visible but the cached response will be returned and it may take time to realise that the cache is there. |
The requests are only cached during UI tests. And each run of
How should that be possible. The requests are sent from the backend/php and not from the browser, so there is no way how the browser could cache them. |
38a4835
to
67846d5
Compare
If you don't want this PR to be closed automatically in 28 days then you need to assign the label 'Do not close'. |
This PR was last updated more than one month ago, maybe it's time to close it. Please check if there is anything we still can do or close this PR. ping @matomo-org/core-reviewers |
Description:
Many of our UI tests might currently request the Marketplace or the Matomo API to look for updates and similar. Depending on the response time this can slow down the tests.
This PR implements a simple caching for requests sent to any Matomo domain during a UI test run. After the run, the cache will be cleared.
Across our 4 UI test suites this currently saves around 200 - 300 requests. Haven't counted that in detail though.
Hard to say how much time that saves. Comparing the run times of this PR and 5.x-dev it seems to be around 1-5 minutes for each suite.
Note: This is not meant to be a final solution and only to improve the current situation a bit. A proper solution would imho be to implement proper response mocks, where we manually place the (expected) responses instead, so the tests don't perform any requests to marketplace/api anymore.
@matomo-org/core-reviewers happy to your opinions on this (temporary) approach.
Review