Skip to content

Commit

Permalink
add tests for mulled v2 hashes
Browse files Browse the repository at this point in the history
to verify if the build is considered as part of the version or not
  • Loading branch information
bernt-matthias committed Jul 10, 2024
1 parent 4b72c22 commit 5b3c4bd
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/galaxy/tool_util/deps/mulled/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ def v2_image_name(
>>> multi_targets_versionless = [build_target("samtools"), build_target("bwa")]
>>> v2_image_name(multi_targets_versionless)
'mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40'
>>> targets_version_with_build = [build_target("samtools", version="1.3.1=h9071d68_10"), build_target("bedtools", version="2.26.0=0")]
>>> v2_image_name(targets_version_with_build)
'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529'
>>> targets_version_with_build = [build_target("samtools", version="1.3.1", build="h9071d68_10"), build_target("bedtools", version="2.26.0", build="0")]
>>> v2_image_name(targets_version_with_build)
'mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619'
"""

if name_override is not None:
print(
"WARNING: Overriding mulled image name, auto-detection of 'mulled' package attributes will fail to detect result."
Expand Down
79 changes: 79 additions & 0 deletions test/functional/tools/mulled_example_multi_2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!-- same as mulled_example_multi_1, but requirements use builds
used to show that this does not yield the same mulled v2 hash,
i.e. the build is considered as part of version -->
<tool id="mulled_example_multi_2" name="mulled_example_multi_2" version="0.1.0" license="AFL-3.0">
<xrefs>
<xref type="bio.tools">bedtools</xref>
<xref type="bio.tools">samtools</xref>
</xrefs>
<creator>
<person
givenName="Björn"
familyName="Grüning"
url="https://github.com/bgruening"
identifier="http://orcid.org/0000-0002-3079-6586" />
<organization
url="https://galaxyproject.org/iuc/"
name="Galaxy IUC" />
</creator>
<requirements>
<requirement type="package" version="1.3.1=h9071d68_10">samtools</requirement>
<requirement type="package" version="2.26.0=0">bedtools</requirement>
</requirements>
<command><![CDATA[
bedtools --version > '$out_file1' &&
echo "Moo" >> '$out_file1' &&
samtools >> '$out_file1' 2>&1 &&
echo "Cow" >> '$out_file1' &&
touch "\${TMP:-/tmp}/job_tmp" &&
touch "\${TEMP:-/tmp}/job_temp" &&
touch "\${TMPDIR:-/tmp}/job_tmpdir"
]]></command>
<inputs>
<param name="input1" type="data" optional="true" />
</inputs>
<outputs>
<data name="out_file1" format="txt" />
</outputs>
<tests>
</tests>
<help><![CDATA[
This is an example mulled tool that combines bedtools and samtools in one
command-line invocation.
]]></help>
<citations>
<citation type="doi">10.1093/bioinformatics/btq033</citation>
<citation type="bibtex">
@misc{SAM_def,
title={Definition of SAM/BAM format},
url = {https://samtools.github.io/hts-specs/},}
</citation>
<citation type="doi">10.1093/bioinformatics/btp352</citation>
<citation type="doi">10.1093/bioinformatics/btr076</citation>
<citation type="doi">10.1093/bioinformatics/btr509</citation>
<citation type="bibtex">
@misc{Danecek_et_al,
Author={Danecek, P., Schiffels, S., Durbin, R.},
title={Multiallelic calling model in bcftools (-m)},
url = {http://samtools.github.io/bcftools/call-m.pdf},}
</citation>
<citation type="bibtex">
@misc{Durbin_VCQC,
Author={Durbin, R.},
title={Segregation based metric for variant call QC},
url = {http://samtools.github.io/bcftools/rd-SegBias.pdf},}
</citation>
<citation type="bibtex">
@misc{Li_SamMath,
Author={Li, H.},
title={Mathematical Notes on SAMtools Algorithms},
url = {http://www.broadinstitute.org/gatk/media/docs/Samtools.pdf},}
</citation>
<citation type="bibtex">
@misc{SamTools_github,
title={SAMTools GitHub page},
url = {https://github.com/samtools/samtools},}
</citation>
</citations>
</tool>
5 changes: 5 additions & 0 deletions test/integration/test_container_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ class MulledTestCase:
mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:a6419f25efff953fc505dbd5ee734856180bb619-0"


class MulledTestCaseWithBuildInfo:
tool_id = "mulled_example_multi_2"
mulled_hash = "mulled-v2-8186960447c5cb2faa697666dc1e6d919ad23f3e:8e86df67d257ce6494ae12b2c60e1b94025ea529-0"


class TestDefaultContainerResolvers(DockerContainerResolverTestCase, ContainerResolverTestCases, MulledTestCase):
"""
Test default container resolvers
Expand Down

0 comments on commit 5b3c4bd

Please sign in to comment.