This commit ensure the expected tables are accessed when a page (not only) is requested. This is needed because without that, we can only check the query count number which might be broken without being noticed: - Commit 1 reduce queries by 2 (no need to access table X anymore) - Commit 2 later reduce queries by 2 (less access on a table) but without noticing it, it also now introduce back the access of table X. At the end the query count is still fine, but the code is not: it broke a previous improvement while it was not necessary. Worst, it could even lower the query count despite still breaking a previous improvement (-3 queries +2 queries back). Also, since the query count of a page is not exactly the same inside a test and in real use cases, an `EXTRA_REQUEST` param is used in those tests to abstract that change and still use the "real use case" query count in the test to fit the reality, be human readable and easier to write/debug. Indeed, in test mode there is more queries due to the test cursor rollback and savepoint, but there is one less query (the cache one). Some commit wrongly reduced that `EXTRA_REQUEST` param making it looks like there was an improvement while there wasn't. This commit will help preventing all of that, ensuring the correct tables are accessed and only those, on top of checking the query count number (we still need to check the query count in case there is a query not catched in the SQL table logs). Some of the PRs/commits where it happened: - https://github.com/odoo/odoo/commit/aa1c1b0bcb5327894c7b00d0454eebae06eaa005 - https://github.com/odoo/odoo/pull/112000/files#r1160851862 closes odoo/odoo#124939 X-original-commit: 26e1fc3abd54a1baa16cf1c99d75d501a8dc6906 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
15 lines
516 B
Python
15 lines
516 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.website.tests.test_performance import UtilPerf
|
|
|
|
|
|
class TestPerformance(UtilPerf):
|
|
def test_10_perf_sql_website_controller_minimalist(self):
|
|
url = '/empty_controller_test'
|
|
select_tables_perf = {
|
|
'base_registry_signaling': 1,
|
|
}
|
|
self._check_url_hot_query(url, 1, select_tables_perf)
|
|
self.assertEqual(self._get_url_hot_query(url, cache=False), 1)
|