test: smoke test reads embedding model from config, not hardcoded literal
a-review (gemini, full migration diff) flagged that the smoke test had the embedding model name baked into the SQL count query, decoupling it from the application's configured value. Read it back from `config.embeddings.model` (env override still wins) so the test stays valid if the default ever moves off nomic-embed-text.
This commit is contained in:
parent
6c1445c8ed
commit
f44ac2ff7c
@ -98,6 +98,15 @@ def test_extraction_round_trip_with_embedding():
|
||||
extraction_id = ext.id
|
||||
source_id = src.id
|
||||
|
||||
# Read the configured model so the test doesn't break if the default
|
||||
# is changed in settings.toml or via EMBEDDING_MODEL.
|
||||
from second_brain.config import load_config
|
||||
|
||||
embedding_model = os.environ.get(
|
||||
"EMBEDDING_MODEL",
|
||||
load_config().embeddings.get("model", "nomic-embed-text"),
|
||||
)
|
||||
|
||||
try:
|
||||
n1 = embed_extraction(extraction_id, summary_text)
|
||||
assert n1 is not None and n1 >= 1, f"first embed should write rows, got {n1}"
|
||||
@ -119,9 +128,9 @@ def test_extraction_round_trip_with_embedding():
|
||||
WHERE source_schema = 'second_brain'
|
||||
AND source_table = 'extractions'
|
||||
AND source_id = %s
|
||||
AND embedding_model = 'nomic-embed-text'
|
||||
AND embedding_model = %s
|
||||
""",
|
||||
(extraction_id,),
|
||||
(extraction_id, embedding_model),
|
||||
)
|
||||
(count,) = cur.fetchone()
|
||||
assert count == n1, f"public.embeddings should hold {n1} rows, has {count}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user