Skip to content

Commit

Permalink
Test that Galaxy raises ConfigurationError when setting `interactiv…
Browse files Browse the repository at this point in the history
…etools_map_sqlalchemy` matches `database_connection` or `install_database_connection` (678bea1)
  • Loading branch information
kysrpex committed Aug 2, 2024
1 parent b6ad695 commit 5320253
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/unit/config/test_config_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,44 @@ def test_error_if_database_connection_contains_brackets(bracket):
config.GalaxyAppConfiguration(override_tempdir=False, amqp_internal_connection=uri)


def test_error_if_interactivetools_map_sqlalchemy_matches_other_database_connections():
"""
The setting `interactivetools_map_sqlalchemy` allows storing the session map in a
database supported by SQLAlchemy. This database must be different from the Galaxy database
and the tool shed database.
Motivation for this constraint:
https://github.com/galaxyproject/galaxy/pull/18481#issuecomment-2218493956
"""
database_connection = "dbscheme://user:password@host/db"
install_database_connection = "dbscheme://user:password@host/install_db"
settings = dict(
override_tempdir=False,
database_connection=database_connection,
install_database_connection=install_database_connection,
)

with pytest.raises(ConfigurationError):
# interactivetools_map_sqlalchemy matches database_connection
config.GalaxyAppConfiguration(
**settings,
interactivetools_map_sqlalchemy=database_connection,
)

with pytest.raises(ConfigurationError):
# interactivetools_map_sqlalchemy matches install_database_connection
config.GalaxyAppConfiguration(
**settings,
interactivetools_map_sqlalchemy=install_database_connection
)

# interactivetools_map_sqlalchemy differs from database_connection, install_database_connection
config.GalaxyAppConfiguration(
**settings,
interactivetools_map_sqlalchemy="dbscheme://user:password@host/gxitproxy"
)


class TestIsFetchWithCeleryEnabled:
def test_disabled_if_celery_disabled(self, appconfig):
appconfig.enable_celery_tasks = False
Expand Down

0 comments on commit 5320253

Please sign in to comment.