mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
Merge pull request #14431 from mvdbeek/cached_image_path_identifier_fix
[22.05] Fix cache image singularity resolver if path contains uppercase chars
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import copy
|
||||
import os
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
@@ -186,8 +187,14 @@ class ContainerDescription:
|
||||
resolve_dependencies: bool = DEFAULT_CONTAINER_RESOLVE_DEPENDENCIES,
|
||||
shell: str = DEFAULT_CONTAINER_SHELL,
|
||||
) -> None:
|
||||
# Force to lowercase because container image names must be lowercase
|
||||
self.identifier = identifier.lower() if identifier else None
|
||||
# Force to lowercase because container image names must be lowercase.
|
||||
# Cached singularity images include the path on disk, so only lowercase
|
||||
# the image identifier portion.
|
||||
self.identifier = None
|
||||
if identifier:
|
||||
parts = identifier.rsplit(os.sep, 1)
|
||||
parts[-1] = parts[-1].lower()
|
||||
self.identifier = os.sep.join(parts)
|
||||
self.type = type
|
||||
self.resolve_dependencies = resolve_dependencies
|
||||
self.shell = shell
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
|
||||
from galaxy.tool_util.deps.requirements import ContainerDescription
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"identifier,expected_identifier",
|
||||
[
|
||||
("mulled-abc", "mulled-abc"),
|
||||
("docker://mulled-abc", "docker://mulled-abc"),
|
||||
("/Cache/mulled-abc", "/Cache/mulled-abc"),
|
||||
("/Cache/mUlled-abc", "/Cache/mulled-abc"),
|
||||
("", None),
|
||||
(None, None),
|
||||
],
|
||||
)
|
||||
def test_container_description(identifier, expected_identifier):
|
||||
assert ContainerDescription(identifier=identifier).identifier == expected_identifier
|
||||
|
||||
|
||||
def test_to_from_dict():
|
||||
container_description_dict = ContainerDescription("mulled-abc").to_dict()
|
||||
container_description = ContainerDescription.from_dict(container_description_dict)
|
||||
assert container_description_dict == container_description.to_dict()
|
||||
Reference in New Issue
Block a user