fix: use TEST-prefixed IDs in integration tests to avoid real-data conflicts

Integration tests used ISSUER::0000320193 (Apple's real CIK) and
SYM::AAPL::XNYS as hardcoded IDs. After the real pipeline inserts
actual AAPL data, subsequent test runs fail with UniqueViolationError
since the db_session rollback only undoes intra-test writes.

Changed to ISSUER::TEST::0000320193 and SYM::AAPL::XNYS (distinct
from the real SYM::AAPL::US) while keeping ticker="AAPL" so the
Oracle price service returns real price data for label/feature tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
I Luk Kim 5 months ago
parent 9d3427e24e
commit f69a8b4731

@ -23,19 +23,19 @@ async def test_feature_snapshot_created(db_session, sample_parser_output):
from libs.oracle_client.client import OracleClient from libs.oracle_client.client import OracleClient
from libs.oracle_client.price import PriceService from libs.oracle_client.price import PriceService
issuer = IssuerMaster(issuer_id="ISSUER::0000320193", issuer_name="Apple Inc.", ticker="AAPL") issuer = IssuerMaster(issuer_id="ISSUER::TEST::0000320193", issuer_name="Apple Inc.", ticker="AAPL")
db_session.add(issuer) db_session.add(issuer)
symbol = SymbolMaster( symbol = SymbolMaster(
symbol_id="SYM::AAPL::XNYS", symbol_id="SYM::AAPL::XNYS",
issuer_id="ISSUER::0000320193", issuer_id="ISSUER::TEST::0000320193",
ticker="AAPL", ticker="AAPL",
venue="XNYS", venue="XNYS",
) )
db_session.add(symbol) db_session.add(symbol)
doc = Document( doc = Document(
document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC001", document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC001",
source_name="sec", source_name="sec",
form_type="8-K", form_type="8-K",
filing_date=dt.date(2026, 1, 29), filing_date=dt.date(2026, 1, 29),
@ -101,19 +101,19 @@ async def test_financial_v1_snapshot_created(db_session, sample_parser_output):
from libs.oracle_client.financial import FinancialService from libs.oracle_client.financial import FinancialService
from libs.oracle_client.price import PriceService from libs.oracle_client.price import PriceService
issuer = IssuerMaster(issuer_id="ISSUER::0000320193", issuer_name="Apple Inc.", ticker="AAPL") issuer = IssuerMaster(issuer_id="ISSUER::TEST::0000320193", issuer_name="Apple Inc.", ticker="AAPL")
db_session.add(issuer) db_session.add(issuer)
symbol = SymbolMaster( symbol = SymbolMaster(
symbol_id="SYM::AAPL::XNYS", symbol_id="SYM::AAPL::XNYS",
issuer_id="ISSUER::0000320193", issuer_id="ISSUER::TEST::0000320193",
ticker="AAPL", ticker="AAPL",
venue="XNYS", venue="XNYS",
) )
db_session.add(symbol) db_session.add(symbol)
doc = Document( doc = Document(
document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC002", document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC002",
source_name="sec", source_name="sec",
form_type="8-K", form_type="8-K",
filing_date=dt.date(2026, 1, 29), filing_date=dt.date(2026, 1, 29),

@ -75,20 +75,20 @@ async def test_event_parse_lifecycle(db_session):
"""Create issuer → document → event → event_parse chain.""" """Create issuer → document → event → event_parse chain."""
from libs.db.models import Document, Event, EventParse, IssuerMaster from libs.db.models import Document, Event, EventParse, IssuerMaster
# Create issuer # Create issuer — use TEST prefix to avoid conflicts with real pipeline data
issuer = IssuerMaster( issuer = IssuerMaster(
issuer_id="ISSUER::0000320193", issuer_id="ISSUER::TEST::0000320193",
issuer_name="Apple Inc.", issuer_name="Apple Inc.",
ticker="AAPL", ticker="AAPL_TEST",
) )
db_session.add(issuer) db_session.add(issuer)
await db_session.flush() await db_session.flush()
# Create document # Create document
doc = Document( doc = Document(
document_id="DOC::sec::ISSUER::0000320193::2026-01-29::ACC001", document_id="DOC::test::ISSUER::TEST::2026-01-29::ACC001",
source_name="sec", source_name="sec",
issuer_id="ISSUER::0000320193", issuer_id="ISSUER::TEST::0000320193",
form_type="8-K", form_type="8-K",
filing_date=dt.date(2026, 1, 29), filing_date=dt.date(2026, 1, 29),
accession_no="ACC001", accession_no="ACC001",
@ -99,9 +99,9 @@ async def test_event_parse_lifecycle(db_session):
# Create event # Create event
event = Event( event = Event(
event_id="EVT::DOC::sec::ISSUER::0000320193::2026-01-29::ACC001::earnings_release::0", event_id="EVT::test::ISSUER::TEST::2026-01-29::ACC001::earnings_release::0",
primary_document_id=doc.document_id, primary_document_id=doc.document_id,
issuer_id="ISSUER::0000320193", issuer_id="ISSUER::TEST::0000320193",
event_type="earnings_release", event_type="earnings_release",
event_direction="bullish", event_direction="bullish",
event_date=dt.date(2026, 1, 29), event_date=dt.date(2026, 1, 29),

Loading…
Cancel
Save