diff --git a/test/unit/app/tools/source_store/test_sqlite_store.py b/test/unit/app/tools/source_store/test_sqlite_store.py index fafbce03710..c4d71b5286d 100644 --- a/test/unit/app/tools/source_store/test_sqlite_store.py +++ b/test/unit/app/tools/source_store/test_sqlite_store.py @@ -5,6 +5,7 @@ import tempfile import pytest +import galaxy.tools.source_store.sqlalchemy as sqlalchemy_store_module from galaxy.tools.source_store import ( ReadOnlyStoreError, StoredToolSource, @@ -75,6 +76,18 @@ def test_index_round_trip(sqlite_path): assert loaded.entries["t1"].name == "T1" +def test_load_index_discards_stale_schema(sqlite_path, monkeypatch): + store = SqliteToolSourceStore(url=_sqlite_url(sqlite_path)) + store.store_index(ToolIndex(entries={"t1": ToolIndexEntry(id="t1", name="T1")})) + + # Simulate a Galaxy upgrade that changed the ToolIndex model: the + # persisted blob's stamp no longer matches, so the store must report "no + # index" (triggering a rebuild) rather than load stale/defaulted fields. + monkeypatch.setattr(sqlalchemy_store_module, "INDEX_SCHEMA_HASH", "post-upgrade-schema-hash") + fresh = SqliteToolSourceStore(url=_sqlite_url(sqlite_path)) + assert fresh.load_index() is None + + def test_read_only_refuses_writes(sqlite_path): rw = SqliteToolSourceStore(url=_sqlite_url(sqlite_path)) rw.store(_source()) diff --git a/tool-data/shed/bwa_mem_index.loc b/tool-data/shed/bwa_mem_index.loc index d4c10ceadcd..6c75d73a7bc 100644 --- a/tool-data/shed/bwa_mem_index.loc +++ b/tool-data/shed/bwa_mem_index.loc @@ -7,8 +7,8 @@ # # # -#So, for example, if you had phiX indexed stored in -#/depot/data2/galaxy/phiX/base/, +#So, for example, if you had phiX indexed stored in +#/depot/data2/galaxy/phiX/base/, #then the bwa_index.loc entry would look like this: # #phiX174 phiX phiX Pretty /depot/data2/galaxy/phiX/base/phiX.fa diff --git a/tool-data/shed/bwa_mem_index.loc.sample b/tool-data/shed/bwa_mem_index.loc.sample index d4c10ceadcd..6c75d73a7bc 100644 --- a/tool-data/shed/bwa_mem_index.loc.sample +++ b/tool-data/shed/bwa_mem_index.loc.sample @@ -7,8 +7,8 @@ # # # -#So, for example, if you had phiX indexed stored in -#/depot/data2/galaxy/phiX/base/, +#So, for example, if you had phiX indexed stored in +#/depot/data2/galaxy/phiX/base/, #then the bwa_index.loc entry would look like this: # #phiX174 phiX phiX Pretty /depot/data2/galaxy/phiX/base/phiX.fa