fix: preserve multi-cause reconcile warnings and align slot blocking
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
e47bebacaf
commit
45a5e4157d
@@ -0,0 +1,42 @@
|
||||
"""PostgreSQLReconcileWarningStore integration tests."""
|
||||
from __future__ import annotations
|
||||
|
||||
from trex_core.adapters.portfolio.reconcile_warning_store import (
|
||||
PostgreSQLReconcileWarningStore,
|
||||
)
|
||||
|
||||
|
||||
def test_warning_store_preserves_multiple_cases_for_same_slot(pg_clean):
|
||||
store = PostgreSQLReconcileWarningStore(pg_clean)
|
||||
store.set_warned("slot-1", portfolio_id="pf-A", case_code="B", reason="b")
|
||||
store.set_warned("slot-1", portfolio_id="pf-A", case_code="C", reason="c")
|
||||
|
||||
assert store.is_warned("slot-1") is True
|
||||
info = store.get_warning_info("slot-1")
|
||||
assert info is not None
|
||||
assert info["case_codes"] == ["B", "C"]
|
||||
|
||||
|
||||
def test_warning_store_case_specific_clear_and_full_clear(pg_clean):
|
||||
store = PostgreSQLReconcileWarningStore(pg_clean)
|
||||
store.set_warned("slot-2", portfolio_id="pf-A", case_code="B")
|
||||
store.set_warned("slot-2", portfolio_id="pf-A", case_code="C")
|
||||
|
||||
store.clear_warned("slot-2", case_code="C")
|
||||
info = store.get_warning_info("slot-2")
|
||||
assert info is not None
|
||||
assert info["case_codes"] == ["B"]
|
||||
|
||||
store.clear_warned("slot-2")
|
||||
assert store.is_warned("slot-2") is False
|
||||
|
||||
|
||||
def test_warning_store_is_durable_across_reinstantiation(pg_clean):
|
||||
a = PostgreSQLReconcileWarningStore(pg_clean)
|
||||
a.set_warned("slot-restart", portfolio_id="pf-A", case_code="B")
|
||||
a.set_warned("slot-restart", portfolio_id="pf-A", case_code="C")
|
||||
|
||||
b = PostgreSQLReconcileWarningStore(pg_clean)
|
||||
info = b.get_warning_info("slot-restart")
|
||||
assert info is not None
|
||||
assert info["case_codes"] == ["B", "C"]
|
||||
Reference in New Issue
Block a user