fix(test): reset instance_config cache in TestRebuildFromRegistry leakage repair
CI ondc03837ashowed test_missing_project_returns_error failing with 'ok-project' instead of '' — config-cache leak from the sibling test_returns_skipped_when_no_bq_rows that ran first under pytest-xdist. Pre-existing flake (cache lives in app.instance_config; monkeypatch restores the loader patch but doesn't invalidate the cached return). Earlier CI runs (a4339ce6) got lucky on test ordering. Adding an explicit reset_cache() at the top of the test removes the dependency on ordering.
This commit is contained in:
parent
dc03837a7b
commit
07c7bd4c8b
1 changed files with 7 additions and 0 deletions
|
|
@ -705,6 +705,13 @@ class TestRebuildFromRegistry:
|
|||
assert "orders" in names
|
||||
|
||||
def test_missing_project_returns_error(self, e2e_env, monkeypatch):
|
||||
# Reset the instance-config cache so a sibling test's patched
|
||||
# `bigquery: {project: "ok-project"}` doesn't leak into this one's
|
||||
# `bigquery: {}` view. The cache is keyed on the loader's first
|
||||
# call, not on monkeypatch's restore — so monkeypatch.setattr alone
|
||||
# isn't sufficient.
|
||||
from app.instance_config import reset_cache
|
||||
reset_cache()
|
||||
monkeypatch.setattr(
|
||||
"config.loader.load_instance_config",
|
||||
lambda: {"data_source": {"type": "bigquery", "bigquery": {}}},
|
||||
|
|
|
|||
Loading…
Reference in a new issue