[UPD] various: update query counters

Update to latest runbot state, at least for tests known to be
deterministic.

Notably mail tests are lower than before, probably due to odoo/odoo#73271

closes odoo/odoo#93470

X-original-commit: 6118ecba8d807ac5ebc69ae4877e1f202b0daeb1
Related: odoo/enterprise#28308
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Thibault Delavallée
2022-06-13 19:10:58 +02:00
parent 76786e8666
commit b71455c328
10 changed files with 63 additions and 63 deletions
@@ -42,7 +42,7 @@ class TestLeadConvertMass(crm_common.TestLeadConvertMassCommon):
with self.assertQueryCount(user_sales_manager=0):
test_leads = self.env['crm.lead'].browse(test_leads.ids)
with self.assertQueryCount(user_sales_manager=141): # crm only: 136 (often), sometimes +2/+3 on runbot // extra queries ~1/week
with self.assertQueryCount(user_sales_manager=141): # crm only: 137 (often), sometimes +2/+3 on runbot // extra queries ~1/week
test_leads._handle_salesmen_assignment(user_ids=user_ids, team_id=team_id)
self.assertEqual(test_leads.team_id, self.sales_team_convert)
@@ -166,7 +166,7 @@ class TestLeadConvertMass(crm_common.TestLeadConvertMassCommon):
test_leads = self._create_leads_batch(count=50, user_ids=[False])
user_ids = self.assign_users.ids
with self.assertQueryCount(user_sales_manager=1041): # 1038 generally on runbot - crm only: 1029 // 1040/41 about once / day on runbot (22h build ?)
with self.assertQueryCount(user_sales_manager=1038): # 1034-35 - crm only: 1029
mass_convert = self.env['crm.lead2opportunity.partner.mass'].with_context({
'active_model': 'crm.lead',
'active_ids': test_leads.ids,
+3 -3
View File
@@ -49,7 +49,7 @@ class TestLeadAssignPerf(TestLeadAssignCommon):
with self.with_user('user_sales_manager'):
self.env['res.users'].has_group('base.group_user') # warmup the cache to avoid inconsistency between community an enterprise
with self.assertQueryCount(user_sales_manager=1279):
with self.assertQueryCount(user_sales_manager=1269):
self.env['crm.team'].browse(self.sales_teams.ids)._action_assign_leads(work_days=2)
# teams assign
@@ -93,7 +93,7 @@ class TestLeadAssignPerf(TestLeadAssignCommon):
leads.flush_recordset()
with self.with_user('user_sales_manager'):
with self.assertQueryCount(user_sales_manager=584):
with self.assertQueryCount(user_sales_manager=583):
self.env['crm.team'].browse(self.sales_teams.ids)._action_assign_leads(work_days=2)
# teams assign
@@ -175,7 +175,7 @@ class TestLeadAssignPerf(TestLeadAssignCommon):
leads.flush_recordset()
with self.with_user('user_sales_manager'):
with self.assertQueryCount(user_sales_manager=6487):
with self.assertQueryCount(user_sales_manager=6433):
self.env['crm.team'].browse(sales_teams.ids)._action_assign_leads(work_days=30)
# teams assign
@@ -25,7 +25,7 @@ class KnowledgePerformanceCase(KnowledgeCommonWData):
@warmup
def test_article_creation_single_shared_grandchild(self):
""" Test with 2 levels of hierarchy in a private/shared environment """
with self.assertQueryCount(employee=22):
with self.assertQueryCount(employee=21):
_article = self.env['knowledge.article'].create({
'body': '<p>Hello</p>',
'name': 'Article in shared',
@@ -37,7 +37,7 @@ class KnowledgePerformanceCase(KnowledgeCommonWData):
@users('employee')
@warmup
def test_article_creation_single_workspace(self):
with self.assertQueryCount(employee=19):
with self.assertQueryCount(employee=18):
_article = self.env['knowledge.article'].create({
'body': '<p>Hello</p>',
'name': 'Article in workspace',
@@ -61,7 +61,7 @@ class KnowledgePerformanceCase(KnowledgeCommonWData):
@users('employee')
@warmup
def test_article_creation_multi_shared_grandchild(self):
with self.assertQueryCount(employee=58):
with self.assertQueryCount(employee=57):
_article = self.env['knowledge.article'].create([
{'body': '<p>Hello</p>',
'name': f'Article {index} in workspace',
@@ -81,7 +81,7 @@ class KnowledgePerformanceCase(KnowledgeCommonWData):
@users('employee')
@warmup
def test_article_invite_members(self):
with self.assertQueryCount(employee=108): # knowledge only: 107
with self.assertQueryCount(employee=86): # knowledge only: 86
shared_article = self.shared_children.with_env(self.env)
partners = (self.customer + self.partner_employee_manager + self.partner_employee2).with_env(self.env)
shared_article.invite_members(partners, 'write')
+3 -3
View File
@@ -52,7 +52,7 @@ class TestPERF(common.TransactionCase):
# + 1 warehouse fetch
# + 1 query to get analytic default account
# + 1 followers queries ?
with self.assertQueryCount(admin=42):
with self.assertQueryCount(admin=40):
self.env['sale.order'].create([{
'partner_id': self.partners[0].id,
'user_id': self.salesmans[0].id,
@@ -63,7 +63,7 @@ class TestPERF(common.TransactionCase):
def test_dummy_sales_orders_batch_creation_perf(self):
""" Dummy SOlines (notes/sections) should not add any custom queries other than their insert"""
# + 2 SOL (batched) insert
with self.assertQueryCount(admin=44):
with self.assertQueryCount(admin=42):
self.env['sale.order'].create([{
'partner_id': self.partners[0].id,
'user_id': self.salesmans[0].id,
@@ -80,7 +80,7 @@ class TestPERF(common.TransactionCase):
# + 2 SQL insert
# + 2 queries to get analytic default tags
# + 9 follower queries ?
with self.assertQueryCount(admin=57):
with self.assertQueryCount(admin=53):
self.env['sale.order'].create([{
'partner_id': self.partners[0].id,
'user_id': self.salesmans[0].id,
@@ -42,7 +42,7 @@ class TestCrmPerformance(CrmPerformanceCase):
country_be = self.env.ref('base.be')
lang_be_id = self.env['res.lang']._lang_get_id('fr_BE')
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=244): # 235, sometimes +6
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=241): # 235, sometimes +6
self.env.cr._now = self.reference_now # force create_date to check schedulers
crm_values = [
{'country_id': country_be.id,
@@ -70,7 +70,7 @@ class TestCrmPerformance(CrmPerformanceCase):
country_be = self.env.ref('base.be')
lang_be = self.env['res.lang']._lang_get('fr_BE')
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=188): # tcf only: 175 - com runbot: 175
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=184): # tcf only: 175 - com runbot: 167
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['crm.lead']) as lead_form:
lead_form.country_id = country_be
@@ -89,7 +89,7 @@ class TestCrmPerformance(CrmPerformanceCase):
@warmup
def test_lead_create_form_partner(self):
""" Test a single lead creation using Form with a partner """
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=193): # tcf only: 180 - com runbot: 180
with freeze_time(self.reference_now), self.assertQueryCount(user_sales_leads=189): # tcf only: 180 - com runbot: 172
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['crm.lead']) as lead_form:
lead_form.partner_id = self.partners[0]
@@ -101,7 +101,7 @@ class TestDiscussFullPerformance(TransactionCase):
self.maxDiff = None
self.env.flush_all()
self.env.invalidate_all()
with self.assertQueryCount(emp=83):
with self.assertQueryCount(emp=81): # ent 80
init_messaging = self.users[0].with_user(self.users[0])._init_messaging()
self.assertEqual(init_messaging, self._get_init_messaging_result())
@@ -36,7 +36,7 @@ class TestEventPerformance(EventPerformanceCase):
batch_size = 20
# simple without type involved
with freeze_time(self.reference_now), self.assertQueryCount(event_user=342): # 336 (sometimes +6)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=341): # 335 (sometimes +6)
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = [
dict(self.event_base_vals,
@@ -52,7 +52,7 @@ class TestEventPerformance(EventPerformanceCase):
batch_size = 20
# simple without type involved + website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=5483): # tef only: 5068? (5064?) - com runbot: 5058 - ent runbot 5483
with freeze_time(self.reference_now), self.assertQueryCount(event_user=5462): # tef only: 5068? (5064?) - com runbot: 5037 - ent runbot 5462
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = [
dict(self.event_base_vals,
@@ -70,7 +70,7 @@ class TestEventPerformance(EventPerformanceCase):
event_type = self.env['event.type'].browse(self.test_event_type.ids)
# complex with type
with freeze_time(self.reference_now), self.assertQueryCount(event_user=449): # 443 (sometimes +6)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=448): # 442 (sometimes +6)
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = [
dict(self.event_base_vals,
@@ -89,7 +89,7 @@ class TestEventPerformance(EventPerformanceCase):
event_type = self.env['event.type'].browse(self.test_event_type.ids)
# complex with type + website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=5597): # tef only: 5178 - com runbot: 5172 - ent runbot 5597
with freeze_time(self.reference_now), self.assertQueryCount(event_user=5576): # tef only: 5178 - com runbot: 5151 - ent runbot 5576
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = [
dict(self.event_base_vals,
@@ -107,7 +107,7 @@ class TestEventPerformance(EventPerformanceCase):
has_social = 'social_menu' in self.env['event.event'] # otherwise view may crash in enterprise
# no type, no website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=229): # tef only: 179? - com runbot: 179
with freeze_time(self.reference_now), self.assertQueryCount(event_user=206): # tef only: 179? - com runbot: 160
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.event']) as event_form:
event_form.name = 'Test Event'
@@ -125,7 +125,7 @@ class TestEventPerformance(EventPerformanceCase):
has_social = 'social_menu' in self.env['event.event'] # otherwise view may crash in enterprise
# no type, website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=692): # tef only: 638? - com runbot: 588 - ent runbot: 692
with freeze_time(self.reference_now), self.assertQueryCount(event_user=671): # tef only: 638? - com runbot: 571 - ent runbot: 671
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.event']) as event_form:
event_form.name = 'Test Event'
@@ -144,7 +144,7 @@ class TestEventPerformance(EventPerformanceCase):
has_social = 'social_menu' in self.env['event.event'] # otherwise view may crash in enterprise
# type and website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=724): # tef only: 673 - com runbot: 624 - ent runbot: 724
with freeze_time(self.reference_now), self.assertQueryCount(event_user=700): # tef only: 673 - com runbot: 604 - ent runbot: 700
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.event']) as event_form:
event_form.name = 'Test Event'
@@ -159,7 +159,7 @@ class TestEventPerformance(EventPerformanceCase):
def test_event_create_single_notype(self):
""" Test a single event creation """
# simple without type involved
with freeze_time(self.reference_now), self.assertQueryCount(event_user=38): # 32 (sometimes +6)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=37): # 31 (sometimes +6)
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = dict(
self.event_base_vals,
@@ -172,7 +172,7 @@ class TestEventPerformance(EventPerformanceCase):
def test_event_create_single_notype_website(self):
""" Test a single event creation """
# simple without type involved + website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=372): # tef only: 347? (342?) - com runbot: 346 - ent runbot 372
with freeze_time(self.reference_now), self.assertQueryCount(event_user=370): # tef only: 347? (342?) - com runbot: 344 - ent runbot 370
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = dict(
self.event_base_vals,
@@ -187,7 +187,7 @@ class TestEventPerformance(EventPerformanceCase):
event_type = self.env['event.type'].browse(self.test_event_type.ids)
# complex with type
with freeze_time(self.reference_now), self.assertQueryCount(event_user=69): # 62 (sometimes +6)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=67): # 61 (sometimes +6)
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = dict(
self.event_base_vals,
@@ -203,7 +203,7 @@ class TestEventPerformance(EventPerformanceCase):
event_type = self.env['event.type'].browse(self.test_event_type.ids)
# complex with type + website
with freeze_time(self.reference_now), self.assertQueryCount(event_user=409): # tef only: 395 (389) - com runbot: 383 - ent runbot 409
with freeze_time(self.reference_now), self.assertQueryCount(event_user=407): # tef only: 395 (389) - com runbot: 381 - ent runbot 407
self.env.cr._now = self.reference_now # force create_date to check schedulers
event_values = dict(
self.event_base_vals,
@@ -225,7 +225,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
"""
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=714): # tef only: 672? - com runbot 711 - ent runbot 714
with freeze_time(self.reference_now), self.assertQueryCount(event_user=713): # tef only: 672? - com runbot 710 - ent runbot 713
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = [
dict(reg_data,
@@ -249,7 +249,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
"""
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=240): # tef only: 197? - com runbot 236
with freeze_time(self.reference_now), self.assertQueryCount(event_user=239): # tef only: 197? - com runbot 235
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = [
dict(reg_data,
@@ -271,7 +271,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
form like) """
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=725): # tef only: 683? - com runbot 722 - ent runbot: 725
with freeze_time(self.reference_now), self.assertQueryCount(event_user=724): # tef only: 683? - com runbot 721 - ent runbot: 725
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = [
dict(reg_data,
@@ -292,7 +292,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
""" Test a single registration creation using Form """
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=225): # tef only: 208? - com runbot: 211 - ent runbot: 225
with freeze_time(self.reference_now), self.assertQueryCount(event_user=210): # tef only: 208? - com runbot: 198 - ent runbot: 210
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.registration']) as reg_form:
reg_form.event_id = event
@@ -308,7 +308,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
""" Test a single registration creation using Form """
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=227): # tef only: 211? - com runbot: 212 - ent runbot: 227
with freeze_time(self.reference_now), self.assertQueryCount(event_user=212): # tef only: 211? - com runbot: 199 - ent runbot: 212
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.registration']) as reg_form:
reg_form.event_id = event
@@ -321,7 +321,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
""" Test a single registration creation using Form """
event = self.env['event.event'].browse(self.test_event.ids)
with freeze_time(self.reference_now), self.assertQueryCount(event_user=138): # tef only: 120? - com runbot 122
with freeze_time(self.reference_now), self.assertQueryCount(event_user=123): # tef only: 120? - com runbot 109
self.env.cr._now = self.reference_now # force create_date to check schedulers
with Form(self.env['event.registration'].with_context(event_lead_rule_skip=True)) as reg_form:
reg_form.event_id = event
@@ -335,7 +335,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
event = self.env['event.event'].browse(self.test_event.ids)
# simple customer data
with freeze_time(self.reference_now), self.assertQueryCount(event_user=138): # tef only: 133? - com runbot: 135 - ent runbot: 138
with freeze_time(self.reference_now), self.assertQueryCount(event_user=136): # tef only: 133? - com runbot: 134 - ent runbot: 136
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = dict(
self.customer_data[0],
@@ -349,7 +349,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
event = self.env['event.event'].browse(self.test_event.ids)
# partner-based customer
with freeze_time(self.reference_now), self.assertQueryCount(event_user=143): # tef only: 141? - com runbot: 142 - ent runbot: 143
with freeze_time(self.reference_now), self.assertQueryCount(event_user=142): # tef only: 141? - com runbot: 141 - ent runbot: 142
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = {
'event_id': event.id,
@@ -364,7 +364,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
event = self.env['event.event'].browse(self.test_event.ids)
# partner-based customer
with freeze_time(self.reference_now), self.assertQueryCount(event_user=56): # tef only: 54? - com runbot: 54 - ent runbot: 56
with freeze_time(self.reference_now), self.assertQueryCount(event_user=55): # tef only: 54? - com runbot: 53 - ent runbot: 55
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = {
'event_id': event.id,
@@ -379,7 +379,7 @@ class TestRegistrationPerformance(EventPerformanceCase):
event = self.env['event.event'].browse(self.test_event.ids)
# website customer data
with freeze_time(self.reference_now), self.assertQueryCount(event_user=145): # tef only: 140? - com runbot: 141 - ent runbot: 145
with freeze_time(self.reference_now), self.assertQueryCount(event_user=144): # tef only: 140? - com runbot: 140 - ent runbot: 144
self.env.cr._now = self.reference_now # force create_date to check schedulers
registration_values = dict(
self.website_customer_data[0],
@@ -428,7 +428,7 @@ class TestOnlineEventPerformance(EventPerformanceCase, UtilPerf):
# website customer data
with freeze_time(self.reference_now):
self.authenticate('user_eventmanager', 'user_eventmanager')
with self.assertQueryCount(default=52): # tef only: 51 (+1 ent)
with self.assertQueryCount(default=49): # tef only: 48 (+1 ent)
self._test_url_open('/event/%i' % self.test_event.id)
@warmup
@@ -436,7 +436,7 @@ class TestOnlineEventPerformance(EventPerformanceCase, UtilPerf):
# website customer data
with freeze_time(self.reference_now):
self.authenticate(None, None)
with self.assertQueryCount(default=31): # tef only: 29? - com runbot: 29 - ent runbot: 31
with self.assertQueryCount(default=27):
self._test_url_open('/event/%i' % self.test_event.id)
@warmup
@@ -444,7 +444,7 @@ class TestOnlineEventPerformance(EventPerformanceCase, UtilPerf):
# website customer data
with freeze_time(self.reference_now):
self.authenticate('user_eventmanager', 'user_eventmanager')
with self.assertQueryCount(default=60): # com runbot: 59 - ent runbot:60
with self.assertQueryCount(default=49): # com runbot: 48 (+1 ent)
self._test_url_open('/event')
@warmup
@@ -452,7 +452,7 @@ class TestOnlineEventPerformance(EventPerformanceCase, UtilPerf):
# website customer data
with freeze_time(self.reference_now):
self.authenticate(None, None)
with self.assertQueryCount(default=34): # com runbot: 34 - ent runbot: 34
with self.assertQueryCount(default=28):
self._test_url_open('/event')
# @warmup
+17 -17
View File
@@ -313,7 +313,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
'partner_ids': [(4, customer_id)],
})
with self.assertQueryCount(__system__=32, employee=38):
with self.assertQueryCount(__system__=25, employee=31):
composer._action_send_mail()
@users('__system__', 'employee')
@@ -335,7 +335,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
'partner_ids': [(4, customer.id)],
})
with self.assertQueryCount(__system__=35, employee=43):
with self.assertQueryCount(__system__=28, employee=36):
composer._action_send_mail()
@users('__system__', 'employee')
@@ -360,7 +360,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
composer_form.attachment_ids.add(attachment)
composer = composer_form.save()
with self.assertQueryCount(__system__=44, employee=52):
with self.assertQueryCount(__system__=37, employee=45):
composer._action_send_mail()
# notifications
@@ -408,7 +408,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
}).create({})
composer._onchange_template_id_wrapper()
with self.assertQueryCount(__system__=32, employee=38):
with self.assertQueryCount(__system__=25, employee=31):
composer._action_send_mail()
# notifications
@@ -435,7 +435,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
}).create({})
composer._onchange_template_id_wrapper()
with self.assertQueryCount(__system__=40, employee=51):
with self.assertQueryCount(__system__=33, employee=44):
composer._action_send_mail()
# notifications
@@ -469,7 +469,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
)
composer = composer_form.save()
with self.assertQueryCount(__system__=41, employee=47):
with self.assertQueryCount(__system__=34, employee=40):
composer._action_send_mail()
# notifications
@@ -501,7 +501,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
)
composer = composer_form.save()
with self.assertQueryCount(__system__=53, employee=70):
with self.assertQueryCount(__system__=46, employee=63):
composer._action_send_mail()
# notifications
@@ -522,7 +522,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_assignation_email(self):
self.user_test.write({'notification_type': 'email'})
record = self.env['mail.test.track'].create({'name': 'Test'})
with self.assertQueryCount(__system__=38, employee=39):
with self.assertQueryCount(__system__=26, employee=27):
record.write({
'user_id': self.user_test.id,
})
@@ -575,7 +575,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_post_one_email_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
with self.assertQueryCount(__system__=31, employee=34):
with self.assertQueryCount(__system__=24, employee=28):
record.message_post(
body='<p>Test Post Performances with an email ping</p>',
partner_ids=self.customer.ids,
@@ -726,7 +726,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
self.container.message_subscribe(self.user_portal.partner_id.ids)
record = self.container.with_user(self.env.user)
with self.assertQueryCount(__system__=54, employee=55): # about 20 (19?) queries per additional customer group
with self.assertQueryCount(__system__=36, employee=37): # about 20 (19?) queries per additional customer group
record.message_post(
body='<p>Test Post Performances</p>',
message_type='comment',
@@ -743,7 +743,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
record = self.container.with_user(self.env.user)
template_id = self.env.ref('test_mail.mail_test_container_tpl').id
with self.assertQueryCount(__system__=62, employee=63): # about 20 (19 ?) queries per additional customer group
with self.assertQueryCount(__system__=43, employee=44): # about 20 (19 ?) queries per additional customer group
record.message_post_with_template(template_id, message_type='comment', composition_mode='comment')
self.assertEqual(record.message_ids[0].body, '<p>Adding stuff on %s</p>' % record.name)
@@ -806,7 +806,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
})
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id)
with self.assertQueryCount(__system__=38, employee=39):
with self.assertQueryCount(__system__=23, employee=24):
rec.write({'user_id': self.user_portal.id})
self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id)
# write tracking message
@@ -826,7 +826,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
customer_id = self.customer.id
user_id = self.user_portal.id
with self.assertQueryCount(__system__=89, employee=90):
with self.assertQueryCount(__system__=55, employee=56):
rec = self.env['mail.test.ticket'].create({
'name': 'Test',
'container_id': container_id,
@@ -855,7 +855,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
self.assertEqual(len(rec1.message_ids), 1)
with self.assertQueryCount(__system__=58, employee=58):
with self.assertQueryCount(__system__=36, employee=36):
rec.write({
'name': 'Test2',
'container_id': self.container.id,
@@ -892,7 +892,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
with self.assertQueryCount(__system__=65, employee=65):
with self.assertQueryCount(__system__=36, employee=36):
rec.write({
'name': 'Test2',
'container_id': container_id,
@@ -925,7 +925,7 @@ class TestMailComplexPerformance(BaseMailPerformance):
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id)
with self.assertQueryCount(__system__=29, employee=30):
with self.assertQueryCount(__system__=19, employee=20):
rec.write({
'name': 'Test2',
'customer_id': customer_id,
@@ -1153,7 +1153,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance):
('attach tuple 3', "attachement tupple content 3", {'cid': 'cid2'}),
]
attachments = self.env['ir.attachment'].with_user(self.env.user).create(self.test_attachments_vals)
with self.assertQueryCount(employee=68):
with self.assertQueryCount(employee=49):
self.cr.sql_log = self.warm and self.cr.sql_log_count
record_container.with_context({}).message_post(
body='<p>Test body <img src="cid:cid1"> <img src="cid:cid2"></p>',
@@ -81,7 +81,7 @@ class TestMailPerformance(BaseMailPerformance):
record_ticket = self.env['mail.test.ticket.mc'].browse(self.record_ticket.ids)
attachments = self.env['ir.attachment'].create(self.test_attachments_vals)
with self.assertQueryCount(employee=101): # tmf: 92 / com: 101
with self.assertQueryCount(employee=68): # tmf: 68 / com: 68
new_message = record_ticket.message_post(
attachment_ids=attachments.ids,
body='<p>Test Content</p>',
+4 -4
View File
@@ -124,9 +124,9 @@ class TestRatingFlow(TestMailFullCommon, TestMailFullRecipients):
partners = self.env['res.partner'].create([
{'name': 'Jean-Luc %s' % (idx), 'email': 'jean-luc-%s@opoo.com' % (idx)} for idx in range(RECORD_COUNT)])
# 3713 requests if only test_mail_full is installed
# 5513 runbot community
# 6313 runbot enterprise
with self.assertQueryCount(__system__=6313):
# 4511 runbot community
# 4911 runbot enterprise
with self.assertQueryCount(__system__=4911):
record_ratings = self.env['mail.test.rating'].create([{
'customer_id': partners[idx].id,
'name': 'Test Rating',
@@ -144,7 +144,7 @@ class TestRatingFlow(TestMailFullCommon, TestMailFullRecipients):
new_ratings = record_ratings.rating_ids.filtered(lambda r: r.rating == 1)
new_ratings.write_date = datetime(2022, 2, 1, 14, 00)
new_ratings.flush_model(['write_date'])
with self.assertQueryCount(__system__=2):
with self.assertQueryCount(__system__=1):
record_ratings._compute_rating_last_value()
vals = [val == 5 for val in record_ratings.mapped('rating_last_value')]
self.assertTrue(all(vals), "The last rating is kept.")