Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test: add explicit head-revision assertions to 5 alembic config-smoke tests (#4294)

LearningCircuit49f37eeacf23
diff --git a/tests/database/test_alembic_migrations.py b/tests/database/test_alembic_migrations.py
index db9b740e2c..c73f7ad65c 100644
--- a/tests/database/test_alembic_migrations.py
+++ b/tests/database/test_alembic_migrations.py
@@ -1135,13 +1135,17 @@ class TestMigrationErrorHandling:
# Make database read-only
os.chmod(db_path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
+ engine = create_engine(f"sqlite:///{db_path}")
try:
- # Try to run migrations again
- engine = create_engine(f"sqlite:///{db_path}")
- # This should either succeed (no changes needed) or fail gracefully
+ # Migration on a read-only DB that's already at head should
+ # be a no-op (no schema changes needed), so it must succeed
+ # and the DB must remain at head.
run_migrations(engine)
- engine.dispose()
+ assert get_current_revision(engine) == get_head_revision(), (
+ "Read-only DB at head should remain at head after no-op migration"
+ )
finally:
+ engine.dispose()
# Restore permissions for cleanup
os.chmod(
db_path,
@@ -1368,7 +1372,9 @@ class TestMigrationRobustness:
)
try:
- run_migrations(engine) # raises on failure
+ run_migrations(engine)
+ # Verify migration actually ran to head, not just "didn't raise"
+ assert get_current_revision(engine) == get_head_revision()
finally:
engine.dispose()
@@ -1672,7 +1678,8 @@ class TestMigrationWithDifferentEngineConfigs:
engine = create_engine(f"sqlite:///{db_path}", echo=False)
try:
- run_migrations(engine) # raises on failure
+ run_migrations(engine)
+ assert get_current_revision(engine) == get_head_revision()
finally:
engine.dispose()
@@ -1682,7 +1689,8 @@ class TestMigrationWithDifferentEngineConfigs:
engine = create_engine(f"sqlite:///{db_path}", pool_pre_ping=True)
try:
- run_migrations(engine) # raises on failure
+ run_migrations(engine)
+ assert get_current_revision(engine) == get_head_revision()
finally:
engine.dispose()
@@ -1698,7 +1706,8 @@ class TestMigrationWithDifferentEngineConfigs:
)
try:
- run_migrations(engine) # raises on failure
+ run_migrations(engine)
+ assert get_current_revision(engine) == get_head_revision()
finally:
engine.dispose()