From ac91975640003d9cd9d410e5e035335d9e53932e Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 31 Mar 2023 17:20:17 +0200 Subject: [PATCH] add test for loading a per destination container resolver config from a file (with global container config configured at the same time) --- .../fallback_container_resolver.yml | 2 + test/integration/test_containerized_jobs.py | 63 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 test/integration/fallback_container_resolver.yml diff --git a/test/integration/fallback_container_resolver.yml b/test/integration/fallback_container_resolver.yml new file mode 100644 index 000000000000..7cd75dba500a --- /dev/null +++ b/test/integration/fallback_container_resolver.yml @@ -0,0 +1,2 @@ +- type: fallback + identifier: 'quay.io/biocontainers/bwa:0.7.15--0' \ No newline at end of file diff --git a/test/integration/test_containerized_jobs.py b/test/integration/test_containerized_jobs.py index 38b29c1ecf01..5223235c7b37 100644 --- a/test/integration/test_containerized_jobs.py +++ b/test/integration/test_containerized_jobs.py @@ -220,6 +220,7 @@ def handle_galaxy_config_kwds(cls, config) -> None: config["jobs_directory"] = cls.jobs_directory config["job_config_file"] = cls.job_config_file disable_dependency_resolution(config) + config.pop("container_resolvers_config_file") container_resolvers_config = [ { "type": "mapping", @@ -235,6 +236,68 @@ def handle_galaxy_config_kwds(cls, config) -> None: config["container_resolvers"] = container_resolvers_config +class TestPerDestinationContainerConfiguration(TestMappingContainerResolver): + """ + This tests: + - that container_resolvers_config_file works when specified in a destination + - and it does so also in presence of a global container_resolvers_config + """ + + @classmethod + def handle_galaxy_config_kwds(cls, config): + super().handle_galaxy_config_kwds(config) + # make sure that job_config_file is unset and set job_config + # its the same content as dockerized_job_conf.yml + the per + # destination container_resolver_config_file + try: + config.pop("job_config_file") + except KeyError: + pass + config["job_config"] = { + "runners": {"local": {"load": "galaxy.jobs.runners.local:LocalJobRunner", "workers": 1}}, + "execution": { + "default": "local_docker", + "environments": { + "local_docker": {"runner": "local", "docker_enabled": True}, + "local_docker_inline_container_resolvers": { + "runner": "local", + "docker_enabled": True, + "container_resolvers_config_file": os.path.join( + SCRIPT_DIRECTORY, "fallback_container_resolver.yml" + ), + }, + }, + }, + "tools": [ + {"id": "upload1", "environment": "local_upload"}, + { + "id": "mulled_example_broken_no_requirements", + "environment": "local_docker_inline_container_resolvers", + }, + ], + } + # define a global container_resolvers (that can not work .. thereby + # showing that the per destination config is used) and make sure that + # container_resolvers_config_file is not set + try: + config.pop("container_resolvers_config_file") + except KeyError: + pass + container_resolvers_config = [ + { + "type": "mapping", + "mappings": [ + { + "container_type": "docker", + "tool_id": "some_bogus_too_id", + "identifier": "quay.io/biocontainers/bwa:0.7.15--0", + } + ], + } + ] + config["container_resolvers"] = container_resolvers_config + + class TestInlineJobEnvironmentContainerResolver(integration_util.IntegrationTestCase): dataset_populator: DatasetPopulator jobs_directory: str