Skip to content

Commit

Permalink
add test for loading a per destination container resolver config
Browse files Browse the repository at this point in the history
from a file (with global container config configured at the same time)
  • Loading branch information
bernt-matthias committed Apr 2, 2023
1 parent a8551c8 commit ac91975
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/integration/fallback_container_resolver.yml
@@ -0,0 +1,2 @@
- type: fallback
identifier: 'quay.io/biocontainers/bwa:0.7.15--0'
63 changes: 63 additions & 0 deletions test/integration/test_containerized_jobs.py
Expand Up @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit ac91975

Please sign in to comment.