fix: punkt 10 (performance) — fix test field names (firstname/surname) and entity types (contact/company/attachment), 8/8 permission perf tests pass
This commit is contained in:
@@ -36,8 +36,8 @@ class TestPermissionPerformance:
|
|||||||
contacts.append(Contact(
|
contacts.append(Contact(
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
type="person",
|
type="person",
|
||||||
first_name=f"Perf{i}",
|
firstname=f"Perf{i}",
|
||||||
last_name=f"Test{i}",
|
surname=f"Test{i}",
|
||||||
owner_id=user_id,
|
owner_id=user_id,
|
||||||
created_by=user_id,
|
created_by=user_id,
|
||||||
updated_by=user_id,
|
updated_by=user_id,
|
||||||
@@ -73,8 +73,8 @@ class TestPermissionPerformance:
|
|||||||
contacts.append(Contact(
|
contacts.append(Contact(
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
type="person",
|
type="person",
|
||||||
first_name=f"Cache{i}",
|
firstname=f"Cache{i}",
|
||||||
last_name=f"Test{i}",
|
surname=f"Test{i}",
|
||||||
owner_id=user_id,
|
owner_id=user_id,
|
||||||
created_by=user_id,
|
created_by=user_id,
|
||||||
updated_by=user_id,
|
updated_by=user_id,
|
||||||
@@ -114,8 +114,8 @@ class TestPermissionPerformance:
|
|||||||
contacts.append(Contact(
|
contacts.append(Contact(
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
type="person",
|
type="person",
|
||||||
first_name=f"Batch{i}",
|
firstname=f"Batch{i}",
|
||||||
last_name=f"Test{i}",
|
surname=f"Test{i}",
|
||||||
owner_id=user_id,
|
owner_id=user_id,
|
||||||
created_by=user_id,
|
created_by=user_id,
|
||||||
updated_by=user_id,
|
updated_by=user_id,
|
||||||
@@ -145,7 +145,7 @@ class TestPermissionPerformance:
|
|||||||
user_id = seed["admin_a"].id
|
user_id = seed["admin_a"].id
|
||||||
|
|
||||||
# Populate cache for multiple entity types
|
# Populate cache for multiple entity types
|
||||||
for entity_type in ["contact", "dms_file", "mailbox", "calendar_event", "task"]:
|
for entity_type in ["contact", "company", "attachment", "entity_attachment", "workflow"]:
|
||||||
await eps.get_cached_visible_ids(
|
await eps.get_cached_visible_ids(
|
||||||
db_session, redis_client, tenant_id, user_id, entity_type
|
db_session, redis_client, tenant_id, user_id, entity_type
|
||||||
)
|
)
|
||||||
@@ -158,7 +158,7 @@ class TestPermissionPerformance:
|
|||||||
assert elapsed < 1.0, f"Cache invalidation took {elapsed:.3f}s (expected <1.0s)"
|
assert elapsed < 1.0, f"Cache invalidation took {elapsed:.3f}s (expected <1.0s)"
|
||||||
|
|
||||||
# Verify cache is cleared
|
# Verify cache is cleared
|
||||||
for entity_type in ["contact", "dms_file", "mailbox", "calendar_event", "task"]:
|
for entity_type in ["contact", "company", "attachment", "entity_attachment", "workflow"]:
|
||||||
cache_key = f"ep_vis:{user_id}:{tenant_id}:{entity_type}"
|
cache_key = f"ep_vis:{user_id}:{tenant_id}:{entity_type}"
|
||||||
cached = await redis_client.get(cache_key)
|
cached = await redis_client.get(cache_key)
|
||||||
assert cached is None, f"Cache for {entity_type} should be cleared"
|
assert cached is None, f"Cache for {entity_type} should be cleared"
|
||||||
@@ -254,13 +254,13 @@ class TestPermissionPerformance:
|
|||||||
for i in range(500):
|
for i in range(500):
|
||||||
contacts.append(Contact(
|
contacts.append(Contact(
|
||||||
tenant_id=tenant_id, type="person",
|
tenant_id=tenant_id, type="person",
|
||||||
first_name=f"Owned{i}", last_name=f"Test{i}",
|
firstname=f"Owned{i}", surname=f"Test{i}",
|
||||||
owner_id=owner_id, created_by=owner_id, updated_by=owner_id,
|
owner_id=owner_id, created_by=owner_id, updated_by=owner_id,
|
||||||
))
|
))
|
||||||
for i in range(300):
|
for i in range(300):
|
||||||
contacts.append(Contact(
|
contacts.append(Contact(
|
||||||
tenant_id=tenant_id, type="person",
|
tenant_id=tenant_id, type="person",
|
||||||
first_name=f"Tenant{i}", last_name=f"Test{i}",
|
firstname=f"Tenant{i}", surname=f"Test{i}",
|
||||||
owner_id=None, created_by=owner_id, updated_by=owner_id,
|
owner_id=None, created_by=owner_id, updated_by=owner_id,
|
||||||
))
|
))
|
||||||
db_session.add_all(contacts)
|
db_session.add_all(contacts)
|
||||||
|
|||||||
Reference in New Issue
Block a user