Skip to content

Commit

Permalink
Tech debt: avoid caching with some test context properties (#3379)
Browse files Browse the repository at this point in the history
## Changes

This PR modifies some properties on the integration test context so that
they don't cache their return values; these properties are based on
internal mutable state and the current caching situation makes it
difficult to know if they are yielding the current value or an earlier
one that might no longer be correct.

### Tests

- existing integration tests
  • Loading branch information
asnare authored Nov 26, 2024
1 parent f6eec46 commit 780008e
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def with_dummy_grants_and_tacls(self):
Grant,
)

@cached_property
@property
def created_databases(self) -> list[str]:
created_databases: set[str] = set()
for udf_info in self._udfs:
Expand All @@ -699,29 +699,17 @@ def created_databases(self) -> list[str]:
created_databases.add(grant.database)
return list(created_databases)

@cached_property
@property
def created_groups(self) -> list[str]:
created_groups = []
for group in self._groups:
if group.display_name is not None:
created_groups.append(group.display_name)
return created_groups
return [group.display_name for group in self._groups if group.display_name is not None]

@cached_property
@property
def created_jobs(self) -> list[int]:
created_jobs = []
for job in self._jobs:
if job.job_id is not None:
created_jobs.append(job.job_id)
return created_jobs
return [job.job_id for job in self._jobs if job.job_id is not None]

@cached_property
@property
def created_dashboards(self) -> list[str]:
created_dashboards = []
for dashboard in self._dashboards:
if dashboard.id is not None:
created_dashboards.append(dashboard.id)
return created_dashboards
return [dashboard.id for dashboard in self._dashboards if dashboard.id is not None]

@cached_property
def azure_service_principal_crawler(self) -> StaticServicePrincipalCrawler:
Expand Down

0 comments on commit 780008e

Please sign in to comment.