mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-06 01:42:11 +02:00
Phase 3: Add path size inference and also bin some stupid migration tests while we're at it
This commit is contained in:
+13
-37
@@ -98,10 +98,7 @@ class TestMigration001:
|
||||
await conn.commit()
|
||||
|
||||
# Run migrations
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
assert applied == 38 # All migrations run
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Verify columns exist by inserting and selecting
|
||||
await conn.execute(
|
||||
@@ -183,9 +180,8 @@ class TestMigration001:
|
||||
applied1 = await run_migrations(conn)
|
||||
applied2 = await run_migrations(conn)
|
||||
|
||||
assert applied1 == 38 # All migrations run
|
||||
assert applied1 > 0 # Migrations were applied
|
||||
assert applied2 == 0 # No migrations on second run
|
||||
assert await get_version(conn) == 38
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -246,8 +242,7 @@ class TestMigration001:
|
||||
applied = await run_migrations(conn)
|
||||
|
||||
# All migrations applied (version incremented) but no error
|
||||
assert applied == 38
|
||||
assert await get_version(conn) == 38
|
||||
assert applied > 0
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -374,10 +369,8 @@ class TestMigration013:
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
# Run migration 13 (plus 14-38 which also run)
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 26
|
||||
assert await get_version(conn) == 38
|
||||
# Run migration 13 (plus remaining which also run)
|
||||
await run_migrations(conn)
|
||||
|
||||
# Bots were migrated from app_settings to fanout_configs (migration 37)
|
||||
# and the bots column was dropped (migration 38)
|
||||
@@ -495,7 +488,6 @@ class TestMigration018:
|
||||
assert await cursor.fetchone() is not None
|
||||
|
||||
await run_migrations(conn)
|
||||
assert await get_version(conn) == 38
|
||||
|
||||
# Verify autoindex is gone
|
||||
cursor = await conn.execute(
|
||||
@@ -572,9 +564,7 @@ class TestMigration018:
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 21 # Migrations 18-38 run (18+19 skip internally)
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
finally:
|
||||
await conn.close()
|
||||
|
||||
@@ -646,7 +636,6 @@ class TestMigration019:
|
||||
assert await cursor.fetchone() is not None
|
||||
|
||||
await run_migrations(conn)
|
||||
assert await get_version(conn) == 38
|
||||
|
||||
# Verify autoindex is gone
|
||||
cursor = await conn.execute(
|
||||
@@ -711,9 +700,7 @@ class TestMigration020:
|
||||
cursor = await conn.execute("PRAGMA journal_mode")
|
||||
assert (await cursor.fetchone())[0] == "delete"
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 19 # Migrations 20-38
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Verify WAL mode
|
||||
cursor = await conn.execute("PRAGMA journal_mode")
|
||||
@@ -742,8 +729,7 @@ class TestMigration020:
|
||||
await conn.commit()
|
||||
await set_version(conn, 20)
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 18 # Migrations 21-38 still run
|
||||
await run_migrations(conn)
|
||||
|
||||
# Still WAL + INCREMENTAL
|
||||
cursor = await conn.execute("PRAGMA journal_mode")
|
||||
@@ -800,9 +786,7 @@ class TestMigration028:
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 11
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Verify payload_hash column is now BLOB
|
||||
cursor = await conn.execute("PRAGMA table_info(raw_packets)")
|
||||
@@ -870,9 +854,7 @@ class TestMigration028:
|
||||
)
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 11 # Version still bumped
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Verify data unchanged
|
||||
cursor = await conn.execute("SELECT payload_hash FROM raw_packets")
|
||||
@@ -920,9 +902,7 @@ class TestMigration032:
|
||||
await conn.execute("INSERT INTO app_settings (id) VALUES (1)")
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 7
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Community MQTT columns were added by migration 32 and dropped by migration 38.
|
||||
# Verify community settings were NOT migrated (no community config existed).
|
||||
@@ -987,9 +967,7 @@ class TestMigration034:
|
||||
""")
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 5
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
# Verify column exists with correct default
|
||||
cursor = await conn.execute("SELECT flood_scope FROM app_settings WHERE id = 1")
|
||||
@@ -1030,9 +1008,7 @@ class TestMigration033:
|
||||
""")
|
||||
await conn.commit()
|
||||
|
||||
applied = await run_migrations(conn)
|
||||
assert applied == 6
|
||||
assert await get_version(conn) == 38
|
||||
await run_migrations(conn)
|
||||
|
||||
cursor = await conn.execute(
|
||||
"SELECT key, name, is_hashtag, on_radio FROM channels WHERE key = ?",
|
||||
|
||||
Reference in New Issue
Block a user