Merge pull request #16027 from jmchilton/vault_testing

Refactor integration tests to create utility for setting up a database vault.
This commit is contained in:
John Chilton
2023-05-04 11:44:50 -04:00
committed by GitHub
4 changed files with 12 additions and 5 deletions
@@ -39,6 +39,8 @@ NO_APP_MESSAGE = "test_case._app called though no Galaxy has been configured."
# Following should be for Homebrew Rabbitmq and Docker on Mac "amqp://guest:guest@localhost:5672//"
AMQP_URL = os.environ.get("GALAXY_TEST_AMQP_URL", None)
POSTGRES_CONFIGURED = "postgres" in os.environ.get("GALAXY_TEST_DBURI", "")
SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
VAULT_CONF = os.path.join(SCRIPT_DIRECTORY, "vault_conf.yml")
def _identity(func):
@@ -243,3 +245,9 @@ class ConfiguresObjectStores:
os.path.join(temp_directory, dir_name)
safe_makedirs(path)
setattr(cls, f"{dir_name}_path", path)
class ConfiguresDatabaseVault:
@classmethod
def _configure_database_vault(cls, config):
config["vault_config_file"] = VAULT_CONF
+2 -2
View File
@@ -15,11 +15,11 @@ from galaxy_test.driver import integration_util
TEST_USER_EMAIL = "vault_test_user@bx.psu.edu"
class TestExtraUserPreferences(integration_util.IntegrationTestCase):
class TestExtraUserPreferences(integration_util.IntegrationTestCase, integration_util.ConfiguresDatabaseVault):
@classmethod
def handle_galaxy_config_kwds(cls, config):
super().handle_galaxy_config_kwds(config)
config["vault_config_file"] = os.path.join(os.path.dirname(__file__), "vault_conf.yml")
cls._configure_database_vault(config)
config["user_preferences_extra_conf_path"] = os.path.join(
os.path.dirname(__file__), "user_preferences_extra_conf.yml"
)
+2 -3
View File
@@ -8,10 +8,9 @@ from galaxy_test.driver import integration_util
SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__))
FILE_SOURCES_VAULT_CONF = os.path.join(SCRIPT_DIRECTORY, "file_sources_conf_vault.yml")
VAULT_CONF = os.path.join(SCRIPT_DIRECTORY, "vault_conf.yml")
class TestVaultFileSourceIntegration(integration_util.IntegrationTestCase):
class TestVaultFileSourceIntegration(integration_util.IntegrationTestCase, integration_util.ConfiguresDatabaseVault):
dataset_populator: DatasetPopulator
USER_1_APP_VAULT_ENTRY = "randomvaultuser1@universe.com"
USER_2_APP_VAULT_ENTRY = "randomvaultuser2@universe.com"
@@ -19,8 +18,8 @@ class TestVaultFileSourceIntegration(integration_util.IntegrationTestCase):
@classmethod
def handle_galaxy_config_kwds(cls, config):
super().handle_galaxy_config_kwds(config)
cls._configure_database_vault(config)
config["file_sources_config_file"] = FILE_SOURCES_VAULT_CONF
config["vault_config_file"] = VAULT_CONF
config["user_library_import_symlink_allowlist"] = os.path.realpath(tempfile.mkdtemp())
def setUp(self):