fix(test): reset instance_config cache in TestRebuildFromRegistry leakage repair

CI on dc03837a showed 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:
ZdenekSrotyr 2026-05-01 23:27:59 +02:00
parent dc03837a7b
commit 07c7bd4c8b

View file

@ -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": {}}},