Skip to content

Commit

Permalink
remove the sleep in the e2e test of local facts uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
omer9564 committed Jun 19, 2024
1 parent 9455d6e commit cb4e91f
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tests/test_rbac_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,9 @@ async def setup_env(
finally:
# cleanup
try:
if is_admin_created:
await permit.api.roles.delete(ADMIN_ROLE_KEY)
if is_viewer_created:
await permit.api.roles.delete(VIEWER_ROLE_KEY)
if is_document_created:
await permit.api.resources.delete(RESOURCE_KEY)
await permit.api.roles.delete(ADMIN_ROLE_KEY)
await permit.api.roles.delete(VIEWER_ROLE_KEY)
await permit.api.resources.delete(RESOURCE_KEY)
assert len(await permit.api.resources.list()) == 0
assert len(await permit.api.roles.list()) == 0
except PermitApiError as error:
Expand Down Expand Up @@ -444,7 +441,7 @@ async def test_local_facts_uploader_permission_check_e2e(
assert permit.api.users.config.proxy_facts_via_pdp is True
document, admin, viewer = setup_env
try:
with permit.synced_facts() as permit:
with permit.wait_for_sync() as permit:
# create a tenant
tenant = await permit.api.tenants.create(
{
Expand Down Expand Up @@ -496,8 +493,6 @@ async def test_local_facts_uploader_permission_check_e2e(
assert ra.user == user.email or ra.user == user.key
assert ra.role == viewer.key
assert ra.tenant == tenant.key
# TODO: remove sleep
await asyncio.sleep(10)
# positive permission check (will be True because elon is a viewer, and a viewer can read a document)
logger.info("testing positive permission check")
resource_attributes = {"secret": True}
Expand Down Expand Up @@ -593,8 +588,6 @@ async def test_local_facts_uploader_permission_check_e2e(
assert assigned_roles[0].role_id == admin.id
assert assigned_roles[0].tenant_id == tenant.id

# TODO: remove sleep
await asyncio.sleep(10)
# run the same negative permission check again, this time it's True
logger.info(
"testing previously negative permission check, should now be positive"
Expand Down

0 comments on commit cb4e91f

Please sign in to comment.